New PHP Interview Questions :: ALLInterview.com http://www.allinterview.com New PHP Interview Questions en-us Would you initialize your strings with single quotes or double quotes http://www.allinterview.com/showanswers/98959.html Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution. How can we extract string ‘abc.com ‘ from a string info@abc.com&quot; http://www.allinterview.com/showanswers/98958.html We can use the preg_match() function with “/.*@(.*)$/” as the regular expression pattern. For example: preg_match(”/.*@(.*)$/”,”info@abc.com”,$data" target="_blank">http://info@abc.com”,$data); echo $data[1]; What is the difference between the functions unlink and unset? http://www.allinterview.com/showanswers/98957.html unlink() is a function for file system handling. It will simply delete the file in context. unset() is a function for variable management. It will make a variable undefined. For printing out strings, there are echo, print and printf. Explain t http://www.allinterview.com/showanswers/98956.html echo is a language construct(You can see we don't use paranthesis for echo).echo does not return any value. print is also a language construct but it returns an integer value. printf is a function..... echo is considered fast than print How can we destroy the session, how can we unset the variable of a se http://www.allinterview.com/showanswers/98955.html session_unregister() - Unregister a global variable from the current session session_unset() - Free all session variables What are the different functions in sorting an array? http://www.allinterview.com/showanswers/98954.html Sorting functions in PHP: asort() arsort() ksort() krsort() uksort() sort() natsort() rsort() How can we know the count/number of elements of an array? http://www.allinterview.com/showanswers/98953.html 2 ways: a) sizeof($array) - This function is an alias of count() b) count($urarray) - This function returns the number of elements in an array. Interestingly if you just pass a simple var instead of an array, count() will return 1. How can we find the number of rows in a result set using PHP? http://www.allinterview.com/showanswers/98952.html Here is how can you find the number of rows in a result set in PHP: $result = mysql_query($any_valid_sql, $database_link); $num_rows = mysql_num_rows($result); echo “$num_rows rows found”; which function used to get the file name in php? http://www.allinterview.com/showanswers/97445.html <?php $path = "/home/httpd/html/index.php"; $file = basename($path); $file = basename($path, ".php"); ?> explain in brief type juggling in php? http://www.allinterview.com/showanswers/97444.html PHP does not require (or support) explicit type definition in variable declaration; a variable's type is determined by the context in which that variable is used. That is to say, if you assign a string value to variable $var, $var becomes a difference of move(), and copy() function in php? http://www.allinterview.com/showanswers/97443.html copy() function copy images for temp folder on server to move other location. move() function cut images for temp folder on server to move other location. describe arguments in header in php? http://www.allinterview.com/showanswers/97442.html header() function has three arguments 1)string:Required. Specifies the header string to send 2)replace: Optional. Indicates whether the header should replace previous or add a second header. Default is TRUE (will replace). FALSE (allows multip how many error types in php? name there? http://www.allinterview.com/showanswers/97441.html four type of error in php. 1.fatal 2.notice 3.warning 4.parse where to change in php.ini file for file uploading? http://www.allinterview.com/showanswers/97440.html You can call the phpinfo() function to find the location of your php.ini file, it will also tell you the current values for the following settings that we need to modify 1.file_uploads 2.upload_max_filesize 3.max_input_time 4.memory_limit how long a default session stay in php? http://www.allinterview.com/showanswers/97439.html Default session time is 24 minutes in php