PHP problem solving interview questions and answers for Experienced and Freshers

Question: How to save image in directory from URL? In Below code, Just update the  $savePath and$ downloadImagePath.Script is Ready. try { $downloadImagePath=’http://www.aboutcity.net/images/aboutcity.png’; $savePath = $_SERVER[‘DOCUMENT_ROOT’]; $ch = curl_init($downloadImagePath); $fp = fopen($savePath . ‘/aboutcity.png’, ‘wb’); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); echo “Image Downloaded Successfully in “.$savePath.’ Folder.’; } catch (Exception $e) […]

Read More »

Frequently asked PHP Questions and Answer in 2015

Question: What is PHP? PHP is a server-side scripting language which is used to create the dynamic web pages. Question: Who is fater of PHP? Rasmus Lerdorf Question: Which language is used to Implementation? C/C++ Question: What is offical website of PHP? http://php.net/ Question: What is current statable version of PHP? Version: 7.0.6 Dated April 29, […]

Read More »

PHP interview questions and answers for 5 year experienced

Question: How array_walk function works in PHP? Purpose: It is used to update the elements/index of original array. How: in array_walk, two parameter are required. 1st: original array 2nd: An callback function, with use of we update the array. Question: Difference Between Zend framework 2 VS Zend framework 1? http://www.web-technology-experts-notes.in/2014/03/zend-framework-2-vs-zend-framework-1.html Question: How to achieve Multilevel […]

Read More »

PHP Mysql Interview Questions and Answers for experienced and freshers

Question: How many ways we can retrieve the data in the result set of MySQL using PHP? Following are different ways $sqlQuery = mysql_query(“SELECT id, name FROM users”); while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { //$row have results }   $sqlQuery = mysql_query(“SELECT id, name FROM users”); while ($row = mysql_fetch_assoc($sqlQuery)) { //$row have results } […]

Read More »

PHP questions and answers for fresher and experienced

Question: How JSON.parse Works? Give few examples? JSON.parse is method which is used parses a string as JSON. How to parse the string as JSON JSON.parse(‘{}’); // {} JSON.parse(‘null’); // null JSON.parse(‘true’); // true JSON.parse(‘”string”‘); // “string” JSON.parse(‘[1, 5, “false”]’); // [1, 5, “false”] Question: How to get the Data of any Public URL(HTML Contents)? […]

Read More »

How to Detect Request type (GET OR Post ) in PHP

Question:How to Detect Request type (Get OR Post) in PHP? $method = $_SERVER[‘REQUEST_METHOD’]; try { switch ($method) { case ‘GET’: /** Add your code here **/ /** Add your code here **/ break; case ‘POST’: /** Add your code here **/ /** Add your code here **/ break; case ‘PUT’: /** Add your code here […]

Read More »

Difficult PHP Interview Questions and Answers

Question: How to check a variable is NULL OR empty string? var_dump($variableName); Also for compare you can use === to compare data type. Question: How can I execute an anonymous function? call_user_func(function() { echo ‘anonymous function called.’; }); Question: How can I measure the speed of code written in PHP? $startTime= microtime(true); /** Write here […]

Read More »

Experienced PHP Questions and Answers

Question: Difference between array_map, array_walk and array_filter? array_map: This function applies the callback to the elements of the given arrays. $arrayData= array_map(‘strtolower’, array(‘One’,’Two’,’three’)); print_r($arrayData); //array ( [0] => one [1] => two [2] => three ) array_walk: This function apply a user supplied function to every member of an array function my_function(&$item, $key){ $item=$item.($key+1); } […]

Read More »

Top PHP Interview Questions and Answers

Question 1: How to redirect a page to another? You can use header function to recirect. header(‘location: http://www.web-technology-experts-notes.in”); //Redirect to home page of another website header(‘location: http://www.web-technology-experts-notes.in/2015/11/php-questions-and-answers-for-experienced.html”); //Redirect to another page and another website header(‘location: php-questions-and-answers-for-experienced.html”); //Redirect to another page of same website header(‘location: php-questions-and-answers-for-experienced.html?topic=php”); //Redirect to another page of same website with parameter header(‘Location: […]

Read More »

OOPs Interview Questions and Answers

What is Object Oriented Programming? Object-oriented programming (OOP) is a programming language model organized around objects rather than actions; Objects are instances of classes, are used to interact with one another. Following are few examples of object-oriented programming languages PHP, C++, Objective-C, Smalltalk, C#, Perl, Python, Ruby. The goals of object-oriented programming are: Increased understanding. […]

Read More »