• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

PHP Interview Questions Answers

Question - 101 : - Give the syntax of REVOKE commands?

Answer - 101 : - The generic syntax for revoke is as following REVOKE [rights] on [database] FROM [username@hostname] Now rights can be: a) ALL privileges b) Combination of CREATE, DROP, SELECT, INSERT, UPDATE and DELETE etc. We can grant rights on all database by using *.* or some specific database by database.* or a specific table by database.table_name.

Question - 102 : - When you want to show some part of a text displayed on an HTML page in red font color? What different possibilities are there to do this? What are the advantages/disadvantages of these methods?

Answer - 102 : - There are 2 ways to show some part of a text in red: 1. Using HTML tag <font color="red"> 2. Using HTML tag <span style="color: red"> When viewing an HTML page in a Browser, the Browser often keeps this page in its cache. What can be possible advantages/disadvantages of page caching? How can you prevent caching of a certain page (please give several alternate solutions)? When you use the metatag in the header section at the beginning of an HTML Web page, the Web page may still be cached in the Temporary Internet Files folder. A page that Internet Explorer is browsing is not cached until half of the 64 KB buffer is filled. Usually, metatags are inserted in the header section of an HTML document, which appears at the beginning of the document. When the HTML code is parsed, it is read from top to bottom. When the metatag is read, Internet Explorer looks for the existence of the page in cache at that exact moment. If it is there, it is removed. To properly prevent the Web page from appearing in the cache, place another header section at the end of the HTML document.

Question - 103 : - How can I make a script that can be bilingual (supports English, German)?

Answer - 103 : - You can change char set variable in above line in the script to support bi language.

Question - 104 : - How To Protect Special Characters in Query String?

Answer - 104 : - 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>"); ?>

Question - 105 : - How can we change the name of a column of a table?

Answer - 105 : - This will change the name of column: ALTER TABLE table_name CHANGE old_colm_name new_colm_name

Question - 106 : - What is the functionality of the functions STRSTR() and STRISTR()?

Answer - 106 : - string strstr ( string haystack, string needle ) returns part of haystack string from the first occurrence of needle to the end of haystack. This function is case-sensitive. stristr() is idential to strstr() except that it is case insensitive.

Question - 107 : - WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP?

Answer - 107 : - 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

Question - 108 : - How can we destroy the cookie?

Answer - 108 : - Set the cookie with a past expiration time.

Question - 109 : - How can we send mail using JavaScript?

Answer - 109 : - No. There is no way to send emails directly using JavaScript. But you can use JavaScript to execute a client side email program send the email using the "mailto" code. Here is an example: function myfunction(form) { tdata=document.myform.tbox1.value; location="mailto:mailid@domain.com?subject=..."; return true; }

Question - 110 : - What is the difference between ereg_replace() and eregi_replace()?

Answer - 110 : - eregi_replace() function is identical to ereg_replace() except that it ignores case distinction when matching alphabetic characters.

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners