- 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
Who is known as the father of PHP?
What was the old name of PHP?
The old name of PHP was Personal Home Page.
Explain the difference between static and dynamic websites?
In static websites, content can’t be changed after running the script. You can’t change anything on the site. It is predefined.In static website you need to change manually.
In dynamic websites, content of script can be changed at the run time. Its content is regenerated every time a user visit or reload. Google, yahoo and every search engine is the example of dynamic website.
Explain the difference between PHP4 and PHP5.
PHP4 doesn’t support oops concept and uses Zend Engine 1.
PHP5 supports oops concept and uses Zend Engine 2.
What are the popular frameworks in PHP?
- Yii 2
- Zend Framework etc.
- What is the use of “echo” in php?It is used to print a data in the webpage, Example: <?php echo ‘Php Training in Patna’; ?> , The following code print the text in the webpage
- How to include a file to a php page?We can include a file using “include() ” or “require()” function with file path as its parameter.
PHP $ and $$ Variables
The $var (single dollar) is a normal variable with the name var that stores any value like string, integer, float, etc.
The $$var (double dollar) is a reference variable that stores the value of the $variable inside it.
- What’s the difference between include and require?If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.
- require_once(), require(), include().What is difference between them? require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page). So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don’t include the file more times and you will not get the “function re-declared” error.
- Differences between GET and POST methods ?We can send 1024 bytes using GET method but POST method can transfer large amount of data and POST is the secure method than GET method .
- What is the purpose of the superglobal variable called $_SERVER ?$_SERVER is an array and it holds the information about paths, headers, and script locations.
- How to Detecting request type in PHP ?By using
- How to declare an array in php?Eg : var $arr = array(‘apple’, ‘grape’, ‘lemon’);
- How to manipulate image files using php ?GD is library that providing image manipulation capabilities to php, so that we can do so many things such as crop, merge, change grayscale and much more with GD functions
- How to manipulate video files using php ?There is no inbuilt library available in php, However there are some open source libraries that providing these features
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. We can install this extension in php and use to do variety of tasks
- What is cron jobs ?Cron jobs are scheduled tasks, executed on regular time intervals set by the developer. They work by running preferred scripts. We can set the time intervals for running these scripts. Its not a part of php compiler, We have several ways to do this based on the platform or the hostign control panel type
- How to sent a POST request from php ( Without using any html ) ?You could use cURL, that allows you to connect and communicate to many different types of servers with many different types of protocols such as http, https, ftp etc.
- What is the use of ‘print’ in php?This is not actually a real function, It is a language construct. So you can use with out parentheses with its argument list.
Example print(‘Latest PHP Interview questions’);
print ‘Job Interview ‘);
- What is use of in_array() function in php ?in_array used to checks if a value exists in an array
- What is use of count() function in php ?count() is used to count all elements in an array, or something in an object
- What’s the difference between include and require?It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.
What is PEAR in PHP?
PEAR is a framework and repository for reusable PHP components. PEAR stands for PHP Extension and Application Repository. It contains all types of PHP code snippets and libraries.It also provides a command line interface to install “packages” automatically.