100+ PHP Questions from Beginner to Expert Level

Good day Developers and you all on Medium in this post i’ll drop over 100 plus PHP Questions. It is very helpful, and you’ll be surprised to see how difficult it is sometimes to go back to the basics.

The PHP Programming language

A PHP exam with questions from beginner to expert level curated by @codehakase

  • What is PHP?
  • What does the initials of PHP stand for?
  • Which programming language does PHP resemble to?
  • What does PEAR stands for?
  • What is the current PHP version?
  • What is a variable?
  • How do you define a variable in PHP?
  • How do you execute a PHP script from the command line?
  • How to run the interactive PHP shell from the command line interface?
  • What are the correct and the most two common way to start and finish a PHP block of code?
  • How can i display the output directly to the browser?
  • What is the main difference between PHP 5 and PHP 7?
  • Is multiple inheritance supported in PHP?
  • What is the meaning of a final class and a final method?
  • How is comparison of objects done in PHP7?
  • How can PHP and HTML interact?
  • What type of operation is needed when passing values through a form or an URL?
  • How can PHP and Javascript interact?
  • What is needed to be able to use image function?
  • What is the use of the function ‘imagetypes()’?
  • What are the functions to be used to get the image’s properties (size, width and height)?
  • How failures in execution are handled with include() and require() functions?
  • What is the main difference between require() and require_once()?
  • How can I display text with a PHP script?
  • How can i display information of a variable and readable by human with PHP?
  • How is it possible to set an infinite execution time for PHP script?
  • What does the PHP error ‘Parse error in PHP — unexpected T_variable at line x’ means?
  • What should i do to be able to export data into an Excel file?
  • What is the function file_get_contents() usefull for?
  • How can i connect to a MySQL database from a PHP script?
  • How the result set of MySQL be handled in PHP (PDO or mysqli)?
  • How is it possible to know the number of rows returned in result set?
  • Which function gives us the number of affected entries by a query?
  • In PDO, What is the difference between $pdo->fetch(PDO::FETCH_ASSOC) and $pdo->fetchAll()?
  • How can i access the data sent through the URL with the GET method?
  • How can i access the data sent through the URL with the POST method?
  • How can i check the value of a given variable is a number?
  • How can i check the value of a given variable is alphanumeric?
  • How do I check if a given variable is empty?
  • What does the unlink() function means?
  • What does the unset() function means?
  • How do I escape data before storing it into the database?
  • How is it possible to remove escape characters from a string?
  • How can i automatically escape incoming data?
  • What does the function get_magic_quotes_gpc() means?
  • Is it possible to remove the HTML tags from data?
  • What is the static variable in function useful for?
  • How can i define a variable accessible in functions of a PHP script?
  • How is it possible to return a value from a function?
  • What is the most convenient hashing method to be used to hash passwords?
  • Which cryptographic extension provide generation and verification of digital signatures?
  • How can i define a Constant in a PHP script?
  • How can you pass a variable by reference?
  • Will a comparison of an integer 12 and a string “13” work in PHP?
  • How is it possible to cast types in PHP?
  • When is a conditional statement ended with an endif?
  • How is the ternary conditional operator used in PHP?
  • What is the function func_num_args() used for?
  • If the variable $var1 is set to 10 and the $var2 is set to the character var1, what’s the value of $$var2?
  • What does accessing a class via :: means?
  • In PHP, objects are they passed by value or by reference?
  • Are Parent constructors called implicitly inside a class constructor?
  • What’s the difference between __sleep and __wakeup?
  • What is a session?
  • How do i initiate a session in PHP?
  • How is it possible to propagate a session id?
  • What is the meaning of a Persistent Cookie?
  • What is the difference between session_unregister() and session_unset()?
  • What does $GLOBALS means?
  • What does $_SERVER means?
  • What does $_FILES means?
  • What is the difference between $_FILES[‘userfile’][‘name’] and $_FILES[‘userfile’][‘tmp_name’]?
  • How can i get the error when there is a problem to upload a file?
  • What does $_ENV means?
  • What does $_COOKIE means?
  • What does the scope of variables means?
  • What the difference between the ‘BITWISE AND’ operator and the ‘LOGICAL AND’ operator?
  • What are the two main string operators?
  • What does the array operator ‘===’ means?
  • What is the differences between $a != $b and $a !== $b?
  • How can i determine whether a PHP variable is an instantiated object of a certain class?
  • What is the goto statement useful for?
  • What is the difference between Exception::getMessage and Exception::getLine ?
  • What does the expression Exception::__toString means?
  • How is it possible to parse a configuration file?
  • How can i determine whether a variable is set?
  • What is the difference between the functions strstr() and stristr()?
  • What is the difference between for and foreach?

Credits

Feel like thanking me?

Why not star the github repo? I’d love the attention! Why not share the link for this repository on Twitter or Facebook? Spread the word!

and also, follow me on twitter!

or fork the repo on github here

Thanks! Francis Sunday.