PHP Interview Questions and Answers For Freshers
1. What is PHP?PHP is a widely-used, open-source server-side scripting language. PHP is an acronym for “PHP: Hypertext Preprocessor.” It allows the developers to develop dynamic web applications. PHP has various frameworks and CMS for developing dynamic and interactive websites.2. What types of loops exist in PHP?for, while, do while and foreach.3. How do you display the output directly to the browser?To display the output directly to the browser, I will use the special tags <?= and ?>.4. Describe which programming language does PHP parallel to?The PHP syntax relates Perl and C.5. How to create a MySQL connection?mysql_connect(servername,username,password);6. How to select a database?mysql_select_db($db_name);7. What is PEAR?PEAR means “PHP Extension and Application Repository.” It is a framework and distribution system for reusable PHP components. It extends PHP and gives a higher level of programming for all web developers. PEAR is divided into three different classes that are: PEAR Core Components, PEAR Packages, and PECL Packages. The PEAR Packages include functionality giving for authentication, networking, and file system features and tools for working with HTML and XML templates.8. What is the use of “ksort” in php?In PHP, Ksort has used to sort an array by key in reverse order.9. What are the data types of PHP?Integers, Doubles, Booleans, Arrays, Objects, NULL, Strings.10. Which PHP version is actually used today?Nowadays, PHP 7 is the actually used version.