YouTube Icon

Interview Questions.

PHP Interview Questions For 2 Years Experienced Candidates - Nov 26, 2021

fluid

PHP Interview Questions For 2 Years Experienced Candidates

Dear Reader, here we will make you comprehended with regards to PHP Interview Questions For 2 Years Experienced Candidates which we look out that the Interviewer needs:- 

1. the innovativeness of the individual that they are exceptionally imaginative, in critical thinking as well as overall as well 

2. designers who are continually learning new things 

3. they are driven by interest 

Questioner for the most part uses to ask combo pack of PHP and SQL. So get ready appropriately and we are certain that you will break the entryway. 

Question: What is the utilization of header() work in PHP? 

1. A header is utilized to divert from the current page to another: 

header(Location: newpage.php); 

2. A header is utilized to send HTTP status code. 

header(HTTP/1.0 404 Not Found); 

3. A header is utilized to Send a crude HTTP header 

(Content-Type: application/pdf); 

Question: What sort of legacy upholds by PHP? 

There are the accompanying sort of legacy 

Single Inheritance Support by PHP 

Various Inheritance Not help 

Various leveled Inheritance Support by PHP 

Staggered Inheritance Support by PHP 

Question: How would you call a constructor for a parent class? 

parent::constructor($value); 

Question: What is the distinction between the capacities unlink and unset? 

unlink: It is utilized to eliminate the document from a server. 

unlink(/way/file.phtml); 

unset: It is utilized to eliminate the variable. 

unset($variableName); 

Question: What are default meeting time and way? 

Meeting Time: 1440 seconds 

Meeting Path:/tmp organizer in server 

Question: What is PEAR? 

PHP Extension and Application Repository (PEAR) is a structure and vault for reusable PHP parts. 

Question: What is MIME? 

Full type of MIME is Multi-reason Internet Mail Extensions. 

It is the expansion of email convention serves to trades the various children of information records over the web. 

Information documents might be sound, video, pictures, application projects and ASCII and so forth 

Question: How to scratch the information from site utilizing CURL? 

To scrap the information from a site, Website should be public and open for scrapable. 

In the blow code, Just update the CURLOPT_URL to which sites information you need to scrap. 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, “http://www.web-technology-experts-notes.in/”); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
$output = curl_exec($ch); 
curl_close($ch); 
echo $output;

Question: How to transfer the record utilizing CURL? 

You can transfer a record utilizing CURL. 

See following focuses. 

1. Transferring record size should be not exactly permitted document by Server. 

2. On the off chance that the document size is powerful, May take additional time. 

3. supplant uploadFile.zip with the document which you need to transfer WITH full way. 

4. supplant http://localhost/test/index2 with URL where the server has given usefulness to transfer the document. 

$file_name_with_full_path = realpath(‘uploadFile.zip’);
$url = “http://localhost/test/index2”;        
$post_data = array(“foo” => “bar”, “upload” => “@”.$file_name_with_full_path );        
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, $post_data);            
   $output = curl_exec($ch);            
   curl_close($ch);        
} 
catch (Exception $e) 
{            
   echo $e->getMessage();            
   die;       
}

Question: Can I set the header in CURL? 

Indeed, you can set the header in CURL utilizing CURLOPT_HEADER. 

curl_setopt($ch, CURLOPT_HTTPHEADER, Array(“Content-Type: text/xml”));

Question: How would i be able to execute PHP File utilizing Command Line? 

For this, you really want PHP CLI(Commnd line interface) 

Only login to you order line interface. 

You need to prepend the PHP and need to make reference to the full-way/relative of document 

Execute the document in after manner. 

php E://wamp/www/project/myfile.php 

Question: How would we be able to get the current meeting id? 

reverberation session_id(); 

You can likewise set the session_id utilizing same above work. 

Question: What are the distinctive kind of arranging capacities in PHP? 

sort() sort exhibits in climbing request. asort() sort acquainted exhibits in climbing request, as per the worth. 

ksort() sort acquainted exhibits in climbing request, as per the key. 

arsort() sort acquainted exhibits in plummeting request, as per the worth. 

rsort() sort exhibits in diving request. 

krsort() sort acquainted exhibits in plummeting request, as per the key. 

array_multisort() sort the multi aspect exhibit. 

usort()- Sort the exhibit utilizing client characterized work. 

Question: How to Swap two factors esteem without utilizing the third factor? 

first Method :- 

<?php
$a = 'Hello';
$b = 'World';
echo "\nBefore swapping:  ". $a . ',' . $b;
list($a, $b) = array($b, $a);
echo "\nAfter swapping:  ". $a . ',' . $b."\n";
?>

The Output will be :- 

The variables before swapping are: Varible a =Hello and b=World                                      
The variables after swapping are: Variable a =World and b=Hello

second Method :- 

$a = 5;
$b = 10;

$a = $a + $b;  // 5 + 10 =15

$b = $a - $b;  // 15 - 10 = 5

$a = $a - $b;  // 15 - 5 = 10

Henceforth the result will be :- 

The numbers before swapping are: Number a =5 and b=10 
The numbers after swapping are: Number a =10 and b=5

 




CFG