Notifications
Article
PHP Interview Question Answers
Published 5 months ago
133
0
PHP Interview Question Answers
1) PHP stand for?
PHP means PHP: Hypertext Preprocessor.
2) Which programming language does PHP resemble?
PHP syntax resembles Perl and C
3) What does PEAR stand for?
PEAR stands for "PHP Extension and Application Repository". It expand PHP and afford a larger level of programming for web developers.

For PPT Click Here : PHP Interview Question Answer


4) What is the actually used PHP version?
7.1 or 7.2 is the suggested version of PHP.
5) From the command line how do you execute a PHP script?
Just utilize the PHP command line interface and define the file name of the script to be executed as follows:
php script.php
6) From the command line interface how to run the interactive PHP shell?
Just utilize the PHP CLI program with the option -a as follows:
php -a
7) What is the correct and the two most common style to begin and complete a PHP block of code?
The two most common style to begin and complete a PHP script are:
<?php [ --- PHP code---- ] ?> and <? [--- PHP code ---] ?>
8) How can we show the output directly to the browser?
we must use the special tags <?= and ?> to show the output directly to the browser.
9) What is the main diversity between PHP 4 and PHP 5?
PHP 5 presents many additional OOP features.
10) Is multiple inheritance supported in PHP?
PHP supports only single inheritance; it means that a class can be extended from only one single class utilizing the keyword 'extended'.
11) What is a final class and a final method?
'final' is introduced in PHP5. Final class means that class cannot be extended and a final method cannot be overridden.
12) How does the objects compare in PHP?
We use the operator '==' for testing two objects are instanced from the same class and have the same attributes and equal values. We can test if two objects are referring to the same instance of the same class by the use of the identity operator '==='.
13) How can PHP and HTML interact?
It is feasible to generate HTML through PHP scripts, and it is desirable to pass part of information from HTML to PHP.
14) What type of operation is required when passing values through a form or a URL?
We need to encode and to decode them utilizing htmlspecialchars() and urlencode() when we want to pass values through a URL or form
15) How can PHP and Javascript interact?
PHP and Javascript cannot directly connect since PHP is a server-side language and Javascript is a client-side language. However, we can exchange variables since PHP can generate Javascript code to be executed by the browser and it is feasible to pass definite variables back to PHP via the URL.
16) What is needed to be able to utilize image function?
GD library is needed to execute image functions.
17) What is the use of the function 'imagetypes()'?
imagetypes() gives the image format and types supported by the current version of GD-PHP.
18) What are the functions to be used to get the image's properties (size, width, and height)?
The functions are getimagesize() for size, imagesx() for width and imagesy() for height.
19) How failures in execution are managed with include() and require() functions?
If the function require() cannot access the file then it ends with a fatal error. However, the include() function provide a warning, and the PHP script continues to execute.
20) What is the main difference between require_once() and require()?
require_once() and require() execute the same task except that the second function checks if the PHP script is already included or not before executing it.
(same for include_once() and include())
21) With a PHP script how can I display text?
Two methods are possible :
<!--?php echo "Method 1"; print "Method 2"; ?-->
22) By a human with PHP How can we display information of a variable and readable?
To be capable to show a human-readable result we utilize print_r().
23) How set an infinite execution time for PHP script?
The set_time_limit(0) added at the starting of a script sets to infinite the time of execution to not have the PHP error extreme execution time overreach.It is also feasible to complete this in the php.ini file.
24) What does the 'Parse error in PHP - unexpected T_variable at line x' means?
This is a PHP syntax error expressing that a mistake at the line x stops parsing and executing the program.
25) What should we do to be capable to export data into an Excel file?
The most natural and used style is to get data into a format supported by Excel. For example, it is possible to write a .csv file, to choose for example comma as a separator between fields and then to open the file with Excel.
If you want to learn more about PHP Interview Question Answer then PHP Training in Chandigarh is the best place for you.
Pratibha Sharma
English Speaking Course in Chandigarh - Marketer
46
Comments