1- What is the difference between ereg_replace() and eregi_replace()?
eregi_replace() function is identical to ereg_replace() except that it ignores case distinction when matching alphabetic characters.
2- How do I find out the number of parameters passed into function9. ?
func_num_args() function returns the number of parameters passed in.
3- If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b?
100, it’s a reference to existing variable.
4- How To Protect Special Characters in Query String?
If you want to include special characters like spaces in the query string, you need to protect them by applying the urlencode() translation function. The script below shows how to use urlencode():
<?php print(“<html>”); print(“<p>Please click the links below” .” to submit comments about TECHPreparation.com:</p>”); $comment = ‘I want to say: “It’s a good site! :->”‘; $comment = urlencode($comment); print(“<p>” .”<a href=”processing_forms.php?name=Guest&comment=$comment”>” .”It’s an excellent site!</a></p>”); $comment = ‘This visitor said: “It’s an average site! “‘; $comment = urlencode($comment); print(“<p>” .’<a href=”processing_forms.php?’.$comment.’”>’ .”It’s an average site.</a></p>”); print(“</html>”); ?>
5- Are objects passed by value or by reference?
Everything is passed by value.
6- What are the differences between DROP a table and TRUNCATE a table?
DROP TABLE table_name – This will delete the table and its data.
TRUNCATE TABLE table_name – This will delete the data of the table, but not the table definition.
7- How do you call a constructor for a parent class?
8- WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP?
Here are three basic types of runtime errors in PHP:
1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although you can change this default behavior.
2. Warnings: These are more serious errors – for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.
3. Fatal errors: These are critical errors – for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP’s default behavior is to display them to the user when they take place.
Internally, these variations are represented by twelve different error types
9- What’s the special meaning of __sleep and __wakeup?
__sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them.
10- How can we submit a form without a submit button?