php

In a php file, you can define a string using ” ” or ‘ ‘. You specify what characters the string consists of in between ‘ ‘ or ” “such […]

The return value of explode function is obvious in most cases, for example: $ar=explode(“\n”,”a\nb”) return an array that has two elements: $ar[0]=’a’,$ar[1]=’b'; But sometimes the return value may cause confusion. […]

$timestamp=gmmktime(22,50,0,2,10,2015); It considers Oct 10,2015,22(hour):50(minute):0(second) is the GMT time. It calculates the seconds between this time and GMT Jan 1,1970,0:0:0.   $timestamp=mktime(22,50,0,2,10,2015); It looks for the time zone settings in […]

php require() will die if the included file has a syntax error even the error line is not executed(i.e., within a function that is not called) for example: file1.php <?php […]

If you do not use header() in your php script, what are the default http headers your browser gets? Here are the http headers php 5.4 generates in the response: […]

Of course, you can put echo or print statements somewhere in the debugged php file to print some messages or value of variables. More convenient way is using an IDE […]

An array can be converted to an object in PHP. <?php $a=array(“aa”,”bb”); $a=(object)$a ?> However you can not access the member of $a because there is not a name for […]

dirname in php may not be what you think it to be: given a full path name of a file, return its directory part. In fact, dirname(pathname) returns the parent […]