phpMyadmin can’t set default value to Null

May 20, 2014

Newer version of phpmyadmin, some user might experience to get error when trying to set a field to NULL. To make this work, make sure that the option Null for the column be checked. Scroll to the right to find Null column.

PHP cURL POST follow location

May 20, 2014

Using cURL to get the last URL address of POSTED is simply add this line to the cURL request: To know the last url from post request, after curl_exec, add this line: Full sxample:

PHP check remote image valid using curl without download content

May 20, 2014

Using curl, without download content, remote image valid can be known. Example: Output: false

PHP initialize objects like arrays

May 20, 2014

In PHP, you can initialize arrays with values quickly using the following notation: To initialize objects, use STDClass To quickly initialize objects like arrays, we can do:

javascript, jQuery convert PHP string to number

May 9, 2014

Working with PHP data inside javascript. Echo or passing a php number in javascript may turn it to be string instead of integer. example:

PHP get array keys only of arrays

April 24, 2014

You can use PHP’s array_keys function to grab the keys: Typical way is loop foreach:

PHP String “0″ or empty issue

April 15, 2014

Given example an empty value of array like: When processed the array and $value = $x->track_value Output value will be always “Manuals”. To fix this issue, add “” into the “1″ or “0″

PHP get latitude and longitude using google maps API

April 15, 2014

Example: Output longitude and latitude which can be very useful for location services. Detailed variable setting see below reference: https://developers.google.com/maps/articles/phpsqlsearch_v3#findnearsql http://stackoverflow.com/questions/8633574/get-latitude-and-longitude-automatically-using-php-api

PHP remove duplicate key or value in multidimensional array

April 15, 2014

Example this multidimensional array having duplicate retailer_id, and we want no duplicate of retailer id in the array although it keep different id information: To clean above: $outputArray is the final clean array. If we want to remove existing key from an array: simply:

PHP trim multiple 00 infront

April 15, 2014

If the number provided is a string, convert it to int and will auto remove the addtional 00: