• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

PHP Interview Questions Answers

Question - 91 : - Explain the ternary conditional operator in PHP?

Answer - 91 : - Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.

Question - 92 : - What’s the difference between md5(), crc32() and sha1() crypto on PHP?

Answer - 92 : - The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1() returns a 128 bit value, and md5() returns a 160 bit value. This is important when avoiding collisions.

Question - 93 : - How can we encrypt and decrypt a data present in a mysql table using mysql?

Answer - 93 : - AES_ENCRYPT() and AES_DECRYPT()

Question - 94 : - What is the maximum length of a table name, a database name, or a field name in MySQL?

Answer - 94 : - Database name: 64 characters Table name: 64 characters Column name: 64 characters

Question - 95 : - What is the difference between Reply-to and Return-path in the headers of a mail function?

Answer - 95 : - Reply-to: Reply-to is where to delivery the reply of the mail. Return-path: Return path is when there is a mail delivery failure occurs then where to delivery the failure notification.

Question - 96 : - What are the other commands to know the structure of a table using MySQL commands except EXPLAIN command?

Answer - 96 : - DESCRIBE table_name;

Question - 97 : -  How can we encrypt and decrypt a data presented in a table using MySQL?

Answer - 97 : - You can use functions: AES_ENCRYPT() and AES_DECRYPT() like: AES_ENCRYPT(str, key_str) AES_DECRYPT(crypt_str, key_str)

Question - 98 : - what is the difference among echo, print and printf?

Answer - 98 : - echo is the most primitive of them, and just outputs the contents following the construct to the screen. print is also a construct (so parentheses are optional when calling it), but it returns TRUE on successful output and FALSE if it was unable to print out the string. However, you can pass multiple parameters to echo, like: <?php echo 'Welcome ', 'to', ' ', 'techpreparations!'; ?> and it will output the string "Welcome to techpreparations!" print does not take multiple parameters. It is also generally argued that echo is faster, but usually the speed advantage is negligible, and might not be there for future versions of PHP. printf is a function, not a construct, and allows such advantages as formatted output, but it’s the slowest way to print out data out of echo, print and printf. I am writing an application in PHP that outputs a printable version of driving directions. It contains some long sentences, and I am a neat freak, and would like to make sure that no line exceeds 50 characters. How do I accomplish that with PHP? On large strings that need to be formatted according to some length specifications, use wordwrap() or chunk_split().

Question - 99 : - How many ways we can pass the variable through the navigation between the pages?

Answer - 99 : - 1. Put the variable into session in the first page, and get it back from session in the next page. 2. Put the variable into cookie in the first page, and get it back from the cookie in the next page. 3. Put the variable into a hidden form field, and get it back from the form in the next page.

Question - 100 : - Are objects passed by value or by reference?

Answer - 100 : - Everything is passed by value.

Computer Contributors

Rajeev Katiyar
Yes Baroda

Share your email for latest updates


Our partners