php interview questions

# 27 basics questions for php Interview

1) What is PHP?
PHP is a web language based on scripts that allow developers to dynamically create generated web pages.

2) What do the initials of PHP stand for?
PHP means PHP: Hypertext Preprocessor.

3) Which programming language does PHP resemble?
PHP syntax resembles Perl and C

4) What does PEAR stand for?
PEAR means PHP Extension and Application Repository. It extends PHP and provides a higher level of programming for web developers.

5) What is the actually used PHP version?
Version 7.1 or 7.2 is the recommended version of PHP.

6) How do you execute a PHP script from the command line?
Just use the PHP command line interface (CLI) and specify the file name of the script to be executed as follows:
php script.php

7) How to run the interactive PHP shell from the command line interface?
Just use the PHP CLI program with the option -a as follows:
php -a

8) What is the correct and the most two common way to start and finish a PHP block of code?
The two most common ways to start and finish a PHP script are:
 <?php [   ---  PHP code---- ] ?> and <? [---  PHP code  ---] ?>

9) How can we display the output directly to the browser?
To be able to display the output directly to the browser, we have to use the special tags <?= and ?>.

10) What is the main difference between PHP 4 and PHP 5?
PHP 5 presents many additional OOP (Object Oriented Programming) features.

11) Is multiple inheritance supported in PHP?
PHP supports only single inheritance; it means that a class can be extended from only one single class using the keyword extended.

12) What is the meaning of a final class and a final method?
final is introduced in PHP5. Final class means that this class cannot be extended and a final method cannot be overridden.

13) How is the comparison of objects done in PHP?
We use the operator == to test is two objects are instanced from the same class and have 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 ===.

14) How can PHP and HTML interact?
It is possible to generate HTML through PHP scripts, and it is possible to pass pieces of information from HTML to PHP.

15) What type of operation is needed when passing values through a form or an URL?
If we would like to pass values through a form or an URL, then we need to encode and to decode them using htmlspecialchars() and urlencode().

16) How can PHP and Javascript interact?
PHP and Javascript cannot directly interact 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 possible to pass specific variables back to PHP via the URL.

17) What is needed to be able to use image function?
GD library is needed to execute image functions.

18) What is the use of the function imagetypes()?
imagetypes() gives the image format and types supported by the current version of GD-PHP.

19) What are the functions to be used to get the imags properties (size, width, and height)?
The functions are getimagesize() for size, imagesx() for width and imagesy() for height.

20) How failures in execution are handled with include() and require() functions?
If the function require() cannot access the file then it ends with a fatal error. However, the include() function gives a warning, and the PHP script continues to execute.

21) What is the main difference between require() and require_once()?
require(), and require_once() perform 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())

22) How can I display text with a PHP script?
Two methods are possible:
<!--?php echo Method 1; print Method 2; ?-->

23) How can we display information of a variable and readable by a human with PHP?
To be able to display a human-readable result we use print_r().

24) How is it possible to set an infinite execution time for PHP script?
The set_time_limit(0) added at the beginning of a script sets to infinite the time of execution to not have the PHP error maximum execution time exceeded. It is also possible to specify this in the php.ini file.

25) What does the PHP error 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.

26) What should we do to be able to export data into an Excel file?
The most common and used way 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.

27) What is the function file_get_contents() useful for?
file_get_contents() lets reading a file and storing it in a string variable.

4.5
79

                                    echo &quot;click on the link given below in source&quot;;

4.5 (8 Votes)
0
3.75
4
Arrem 110 points

                                    $text = &quot;I like programming&quot;;
print_r (explode(&quot; &quot;,$text));
$strarr = array('Pen','Pencil','Eraser');
echo implode(&quot; &quot;,$strarr);

3.75 (4 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
guru php questions php client interview questions php beginners level interview questions and answer basic php coding questions PHP coding questions php interview programs on function php function questions answe PHP top 10 interview questions php interview programs for freshers commonly asked questions for php core php programming interview questions and answers core php practical interview questions and answers core php code interview questions and answers core php code interview questions php interview questions coding php intervieew questions logical interview questions for php interview questions of php developer php interview querytions questions techniques php php engineer interview questions php practical questions and answers interview question in php program for technical interview in php php senior interview questions mysql database php interview questions Frequently asked php interview questions problem solving interview questions php php technical interview questions for freshers php interview questions and answers pdf viva questions on php php interview quesion php interview practical questions technical interview questions for php php intervew questions php interview quession php interview looping questions for freshers which topics of php for interview php logical interview question php interview questions advance php logic interview questions php important question in interview php interview questions and answers senior php interview interviewbit php interview advanced questions and answers php code interview questions php interview questions umniah php interview questions ans answers php coding questions and answers php coding interview question php interview question and answer for fresher php interview questions senior php interview quesstion php interview question s php experience interview questions and answers important php interview questions php interview programming questions for experienced sharp PHP questions php fresher interview questions practical interview quiesions php mysql interview questions in php php backend interview question basic php interview question interview questions for php developer php mysql interview question php interview programs for experienced php fresher interview questions php interview tasks programming interview questions php basic questions for php interview php basic questions and answers for interview php questions asked in interview for experienced candidates php interivew questions php interview questions answers php coding interview questions and answers for experienced example question in php what is php interview questions php interview for fresher PHP Questions &amp; Answers question answer php core php basic interview practical questions core php basic interview questions logical interview questions in php php interview project php exerienced interview questions php interview questions operators php lead interview questions php technical program questions interview questions for freshers in php interviewbit php php problem solving interview questions functions in php interview questions php technical interview questions for experienced php problems questions and answers php sample project for interview for loop interview questions php acing a php interview Most important PHP Interview Questions and Answers php functions list for interview questions and answers how to take php interview basic php interview questions for freshers php basic interview questions and answers basic php interview programming questions freshers php interview questions php interview coding interview php questions top php interview questions logical interview question answer php php intervie questions php interview questions for experienced professionals basic php programming questions php experienced interview questions and answers 2021 php interview programs interveiw questions for php php technical interview questions and answers interview question php technical interview question php tnq php interview questions core php interview quention php interview questions advanced top interview questions in php interview questions asked for php developer php inteview questions php web architecture interview questions php interviewinria php interview question inria php developer interview questions and answers for experienced php interview questions for fresher php mysql interview questions php interview questions for php freshers php interview questions and answers for experienced candidates database questions in php php interview questions and answers for experienced tutorialspoint guru php interview questions senior PHP questions php interview quesions php interview questions tutorialspoint php interview questions - Top 50 questions for php developers php questions asked in interview time php question asked in interview time advanced PHP interview question php code interview prepare php important questions for interview php question ask in interview time mysql interview questions for experienced php developers basic php questions and answers top questions in php interview php questions and answers for freshers in it toptal php interview questions technical interview php php code questions and answers junior php interview questions php based interview questions php interview vragen php array interview questions php basic viva questions php interview qustion and answer logical interview questions and answers php php techniqcal interview questions php logical interview qusetions php interview qusetions php logical interview questions interview questions for a php developer most commom question in php interview php interview questions with answers programming questions php interview questions and answers php developer all php interview questions basic interview questions for php php freshers interview question interview question i php php to make questions basic questions of php php logical interview questions and answers php code questions core php interview questions and answers php programming interview questions php practical interview questions interview questions and answers for freshers in php PHP MySQL Interview Questions and Answers for experienced php interview question general how to questions in php php interview questions ans php basics for interview programming interview questions and answers php php interview questions junior question answers in php using senior php interview questions interview questions and answers php Advanced PHP Interview Questions interview questions php experienced php interview questions php programs for interview php basic interview questions for freshers php database interview questions php and mysql interview questions and answers php coding interview questions php interview questions for freshers 2020 code interview questions php php sql questions top php interview questions and answers for experienced php coding questions interview php questions easy interview easy questions in php questions and answers about php php &amp; mysql interview questions advanced php interview questions and answers advanced interview questions in php php interview programming questions php frequently asked questions php interview code questions commone php questions interview php interview questions for experience php inerview question ask questions in php ctl ask questions in php interview questions and answers of php php interview technical questions php developer interview questions for experienced core php interview questions interview questions php developer php most asked questions programming questions on php php intermediate interview questions php programming questions php developer job interview questions some basic interview questions php php development for beginners interview questions php developer interview questio ns php fundamentals interview questions php developer questions for interview php onterview question basics of php for interview top 10 php interview questions and answers php basic interview questions for experienced php interview questions 5 functions 4 options and answers based interview questions for php experienced choice based php interview questions and answers php programming interview questions for experienced php interview questions top php questions asked in interview php interview experince questions php interview questions pdf php development interview questions php interview q&amp;a online quiz using php project interviwe question interview questions related php core php interview questions for 3 year experience php core interview questions +2years 8+ php interview questions php interview questions for 1 year experience php oop interview questions most common php lavra interview questions php starts questions php related questions for interview php top 50 php telephonic interview questions and answers where i can ask questions about php question ask for php php core interview notes core php interview task practical core php interview task php freshers interview questions $ask in php php developer interview questions for freshers php files interview questions php form interview questions php interview questions and answers for 10 year experience top viva questions for php php common interview questions quora php fresher question php interview questions and answers for experienced web developer php interview questions and answers for freshers php all questions and answers php developers interview question php 7 interview questions php interview q &amp; a php linked question php interview tasts basic php questions viva basic php questions HP PHP Interview questions top php interview questions and answers for freshers technical questions on php oop interview questions php questions related to PHP coding standards php experienced interview questions php interview coding questions php advanced interview questions most frequently asked php interview questions php related questions question language php php technical questions php technical interview questions what to learn for php interviews questions and answers practice interview questions php top php questions interview php interview questions and answers for 4 year experience Questions about PHP interview questions and answers for experience in php php questions interview php questions to ask in an interview php questions in interview questions to ask php developer interview php interview questions experienced php questions for experienced interview questions in php php questions for interview php basic questions and answers php invterview questions sample php write questions php company interview php questions and answers pdf questions asked in interview for php developer interview questions php php basic questions for interview for 3 experienced php basic questions for interview php interview questions backend interview question for php experience php job interview questions php anf framework interview question php interview questions in pdf php interview questions for freshser php interview quetions php basic questions interview questions of php html &amp; css &amp; php interview question interview question on core php php interview basic coding questions on mysql php php interview practice common php interview questions common php interview php interview questions for freshers php backend interview questions php server side interview questions and answers php framework interview questions php question contact php interview questions php interview questions and answers for experienced some php interview questions what are the questions asked in php interview php interview practice questions php intreview question php core interview questions php interiew questions logical questions for php developer php concepts for interview basic php interview questions interview questions on php top 100 php interview questions core php interview questions interview questions for php php interview questions and answers php developer interview questions how to prepare for php developer interview interview question of php php questions latest php interview questions for experienced interview question and answer for php top questions about php php question and answer php interview questions for experienced interview questions and answers for php web developer php interview question php questions and answers php coding questions set php interview qiestions php interview questions for 4 years experience interview question on php php interview questions for 4 year experience php basic interview questions php viva questions common php questions php interview questions
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source