PHP Advanced Interview Questions and Answers

Question: What is PEAR in php? PEAR means PHP Extension and Application Repository. PEAR is a framework and distribution system for reusable PHP components. PEAR can be installed by bringing an automated wizard. Following are main purpose of PEAR A structured opensource library . Distribution and package maintenance. The PHP Foundation Classes (PFC) The PHP […]

Read More »

PHP Interview Questions and Answers for 3 year Experience

Question: How to explode a string using multiple delimiters(“,” and “|” )? $string=’php, interview | questions , and | answers ‘; $output = preg_split( “/(\,|\|)/”, $string ); print_r($output ); /* Array ( [0] => php [1] => interview [2] => questions [3] => and [4] => answers ) */ Question: What is Late static bindings […]

Read More »

PHP interview questions and answers for experienced

Question: How to POST Data using CURL in PHP? $url = “http://www.example.com/ajax/testurl”; $postData = ‘this is raw data’; try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$postData); curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: text/plain’)); echo $output = curl_exec($ch); curl_close($ch); } catch (Exception $e) { echo $e->getMessage();die; } Question: How to re-index […]

Read More »

PHP interview questions and answers for 3 year of experience

Question: Are PHP functions case sensitive? No, functions are case in-sensitive In built functions are are case-insensitive like print, strtolower, array_merge etc. user defined functions are also are case-insensitive (New function created by user as per requirment). Question: How to return call by reference value from function? Just use &(ampersand) before the function name. For […]

Read More »

ThinkPHP framework SQL queries with examples

Question: How to create Model Object? $userObj= D(“Common/Users”); Question: How to add simple AND Query? $map=array(); $userObj= D(“Common/Users”); $map[‘user_type’] = 2; $map[‘city_id’] = 10; $lists = $userObj ->alias(“u”) ->where($map) ->order(“u.id DESC”) ->select(); Question: How to add simple OR Query? $map=array(); $userObj= D(“Common/Users”); $map[‘u.username|u.email’] = ’email@domain.com’; //username OR email is email@domain.com $lists = $userObj ->alias(“u”) ->where($map) […]

Read More »

PHP Redis Interview questions and answers

Question: Why Redis is different as compared to other key-value stores? Redis values can contain more complex data types, with atomic operations. Redis is an in-memory but persistent on disk database. Question: How to delete current database? redis-cli flushdb Question: How to remove all database? redis-cli flushall Question: How to check redis is running? try […]

Read More »

Fresher PHP Interview Questions and Answers

Question: What is PHP? Answer:  PHP is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.   Question: What is name of function that allows you to store session data in a database? Answer: session_set_save_handler   Question: What is obj_start()? Answer:It is used to initialize the […]

Read More »