PHP check if a url is valid using filter_var

February 12, 2014

URL can simply validate use FILTER_VALIDATE_URL in filter_var(). For example: IT can be in a function:

PHP – How to check if variable is an array?

February 12, 2014

PHP has an internal variables handling functions to finds whether a variables is an array Another fastest way of determining an array is by: Cast the value to an array, then check using (===) if it is identical to the original.

MySql query ORDER BY two columns

January 24, 2014

You can order by multiple columns in mysql. The first order take first preference and then second one get next preference in mysql. Example: Statement lik: will sort both columns descending. If specified each column ASC or DESC, first order will take first preference and then second one get next preference in mysql

PHP obfuscated or hide part of the email address

January 17, 2014

I wrote my own function for one of the project to display first 3 characters and last characters before the @. In between the first and last 3 characters, put in 3 star (*). So, this is how it looks like

PHP operator == vs ===

December 17, 2013

The operator == casts between two different types if they are different, while the === operator performs a ‘typesafe comparison’. That means that it will only return true if both operands have the same type and the same value. Examples: However, two instances of the same class do NOT match the === operator. Example:

JSON value not showing in HTML by PHP

December 16, 2013

There are few possibility why JSON data not being displayed properly. To debug your data, use If print_r shows empty or nothing, use Output: string ‘{"en":"Home","fr":"Office","cn":"bar"}’ (length=1 Possibility 1) – json data being encoded to html code. Some CMS will encoded the json data output. To solve this html entity issue, decode the data like […]

Processing PHP array with json jquery $.each() get key value

December 11, 2013

A simple start will be, example array Output: “1″ Another example given array: Output: “136438349186fwjbr is test3″ etc….