Code Snippets

Quick Code Examples, less explanation.



  • JavaScript debugging function similar to PHP var_dump / print_r

    Debug JavaScript array or object as like PHP’s print_r or var_dump function. create your own javascript debugging function

  • JavaScript Regular Expression

    JavaScript Regular Expressions are quite same as PHP Regular Expressions. Syntax var check = /pattern/modifiers; pattern specifies the pattern of an expression modifiers specify if a search should be global, case-sensitive, etc. Modifiers Modifiers are used to perform case-insensitive and…



  • How to check & increase PHP memory usage

    To check PHP menory usage function display_used_memory() { $m = memory_get_usage(); $d = 1024 * 1024; echo number_format( $m / $d, 2 ).”MB”; } put display_used_memory() as the end of your PHP file. To increase PHP memory usage if( !ini_get(…

  • Hex color validation with regex

    Php code for validating hex color

  • PHP Regular Expression Character Definition

    To user PHP regular expression with preg_match, preg_replace or other preg_ function, one should understand the characters that are used. Below listed all of the characters that are used in regex. List of Regular Expression Characters ^ // Match the…