Sr. PHP Programmer Interview Preparation Guide
Refine your Senior PHP Programmer interview skills with our 202 critical questions. Each question is crafted to challenge your understanding and proficiency in Senior PHP Programmer. Suitable for all skill levels, these questions are essential for effective preparation. Access the free PDF to get all 202 questions and give yourself the best chance of acing your Senior PHP Programmer interview. This resource is perfect for thorough preparation and confidence building.202 Senior PHP Programmer Questions and Answers:
1 :: Explain What is PHP?
PHP is a server side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites.Even a non technical person can cretae sites using its CMS.WordPress,osCommerce are the famus CMS of php.It is also an object oriented programming language like java,C-sharp etc.It is very eazy for learning
2 :: Explain what are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?
☛ Mysql_fetch_array Fetch a result row as an associative array, a numeric array, or both.
☛ mysql_fetch_object ( resource result ) Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows
☛ mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.
☛ mysql_fetch_object ( resource result ) Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows
☛ mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.
3 :: What is MVC in PHP context?
Most programmers know this, but interviewers will likely look for a deep understanding of MVC, and some explanation or examples on how/why/ when you used it.
MVC- Model, View, Controller - is simply a way of organizing your code into 3 separate layers each with there own job.
☛ Model - Usually contains data access code and all of you business logic code.
☛ View - Contains markup/design code, generally html,xml, json.
☛ Controller - Usually contains very little code, just whatever is needed to call the Model code and render the View code.
MVC- Model, View, Controller - is simply a way of organizing your code into 3 separate layers each with there own job.
☛ Model - Usually contains data access code and all of you business logic code.
☛ View - Contains markup/design code, generally html,xml, json.
☛ Controller - Usually contains very little code, just whatever is needed to call the Model code and render the View code.
4 :: What are some magic methods in PHP, how might you use them?
Magic methods are basically triggers that occur when particular events happen in your coding. __GET, __SET are magic methods that are called (behind the seen) when you get or set a class property.
5 :: Can the value of a constant change during the script's execution?
No, the value of a constant cannot be changed once it's declared during the PHP execution.
6 :: What are PSRs? Choose 1 and briefly describe it?
PSRs are PHP Standards Recommendations that aim at standardizing common aspects of PHP Development.
An example of a PSR is PSR-2, which is a coding style guide.
An example of a PSR is PSR-2, which is a coding style guide.
7 :: Explain the different types of errors in PHP?
Notices, Warnings and Fatal errors are the types of errors in PHP
☛ Notices:
Notices represents non-critical errors, i.e. accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all but whenever required, you can change this default behavior.
☛ Warnings:
Warnings are more serious errors but they do not result in script termination. i.e calling include() a file which does not exist. By default, these errors are displayed to the user.
☛ Fatal errors:
Fatal errors are critical errors i.e. calling a non-existent function or class. These errors cause the immediate termination of the script.
☛ Notices:
Notices represents non-critical errors, i.e. accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all but whenever required, you can change this default behavior.
☛ Warnings:
Warnings are more serious errors but they do not result in script termination. i.e calling include() a file which does not exist. By default, these errors are displayed to the user.
☛ Fatal errors:
Fatal errors are critical errors i.e. calling a non-existent function or class. These errors cause the immediate termination of the script.
8 :: Explain the purpose of output buffering in PHP?
Output buffering in PHP buffers a scripts output. This buffer can be edited before returning it to the client. Without output buffering, PHP sends data to the web server as soon as it is ready. Output buffering "send" cookies at any point in the script. Cookies do not have to be necessarily sent near the start of page. Output buffers are stackable and hence sending to output is by choice.
9 :: What is the use of "echo" in php?
It is used to print a data in the webpage, Example: <?php echo 'Global Guideline'; ?> , The following code print the text in the webpage
10 :: What is use of count() function in php?
count() is used to count all elements in an array, or something in an object