Question-71. What is the purpose of $_SESSION variable in PHP ?

Answer- $_SESSION − An associative array containing session variables available to the current script.

Question-72. What is the purpose of $_PHP_SELF variable in PHP ?

Answer- $_PHP_SELF − A string containing PHP script file name in which it is called.

Question-73. What is the purpose of $php_errormsg variable in PHP ?

Answer- $php_errormsg − $php_errormsg is a variable containing the text of the last error message generated by PHP.

Question-74. How ereg() function works ?

Answer- ereg() − The ereg() function searches a string specified by string for a string specified by pattern, returning true if the pattern is found, and false otherwise.

Question-75. How eregi() function works ?

Answer- eregi() − The eregi() function searches throughout a string specified by pattern for a string specified by string. The search is not case sensitive.

Question-76. How split() function works ?

Answer- The split() function will divide a string into various elements, the boundaries of each element based on the occurrence of pattern in string.

Question-77. How preg_match() function works ?

Answer- preg_match() – The preg_match() function searches string for pattern, returning true if pattern exists, and false otherwise.

Question-78. How preg_split() function works ?

Answer- The preg_split() function operates exactly like split(), except that regular expressions are accepted as input parameters for pattern.

Question-79. How will you retrieve the error message using Exception class in PHP when error occurred ?

Answer- Using getMessage() method of Exception class which returns the message of exception.

Question-80. How will you retrieve code of exception using Exception class in PHP when error occurred ?

Answer- Using getCode() method of Exception class which returns the code of exception.