SlideShare a Scribd company logo
1 of 12
PHP
Interview
Questions 1 To 10
1. What is PHP ?
PHP: Hypertext Preprocessor is open source
server-side scripting language that is widely
used for creation of dynamic web applications.It
was developed by Rasmus Lerdorf also know as
Father of PHP in 1994.
PHP is a loosely typed language , we didn’t have
to tell PHP which kind of Datatype a Variable is.
PHP automatically converts the variable to the
correct datatype , depending on its value.
Online Interview Question
2. What is T_PAAMAYIM_NEKUDOTAYIM
?
T_PAAMAYIM_NEKUDOTAYIM is scope resolution
operator used as :: (double colon) .Basically it
used to calling static methods/variables of a
Class.
Example usage:-
$Cache::getConfig($key);
Online Interview Question
3. What is the difference between =
= and = = = operation PHP ?
In PHP == is equal operator and returns TRUE if $a is equal to
$b after type juggling and === is Identical operator and return
TRUE if $a is equal to $b, and they are of the same data type.
Example Usages:
<?php $a=true ; $b=1; // Below condition returns true and
prints a and b are equal if($a==$b){ echo "a and b are equal";
}else{ echo "a and b are not equal"; } //Below condition
returns false and prints a and b are not equal because $a and
$b are of different data types. if($a===$b){ echo "a and b are
equal"; }else{ echo "a and b are not equal"; } ?>
Online Interview Question
4. How to register a variable in
PHP session ?
In PHP 5.3 or below we can register a variable
session_register() function.It is deprecated now and
we can set directly a value in $_SESSION Global.
Example usage:
<?php // Starting session session_start(); // Use of
session_register() is deprecated $username = "PhpScots";
session_register("username"); // Use of $_SESSION is preferred
$_SESSION["username"] = "PhpScots"; ?> Also Read Laravel
interview questions
Online Interview Question
5. Where sessions stored in PHP ?
PHP sessions are stored on server generally in text
files in a temp directory of server.
That file is not accessible from outside word. When
we create a session PHP create a unique session id
that is shared by client by creating cookie on clients
browser.That session id is sent by client browser to
server each time when a request is made and session
is identified.
The default session name is “PHPSESSID”.
Online Interview Question
6. What is default session time and path
in PHP. How to change it ?
Default session time in PHP is 1440 seconds (24 minutes) and Default
session storage path is temporary folder/tmp on server.
You can change default session time by using below code.
<?php // server should keep session data for AT LEAST 1
hour ini_set('session.gc_maxlifetime', 3600); // each
client should remember their session id for EXACTLY 1
hour session_set_cookie_params(3600); ?>
Online Interview Question
7. What are PHP Magic
Methods/Functions. List them ?
In PHP all functions starting with __ names are magical
functions/methods. Magical methods always lives in a
PHP class. The definition of magical function are defined
by programmer itself.
Here are list of magic functions available in PHP
__construct(), __destruct(), __call(), __callStatic(),
__get(), __set(), __isset(), __unset(), __sleep(),
__wakeup(), __toString(), __invoke(), __set_state(),
__clone() and __debugInfo() .
Online Interview Question
8. How to increase the execution time of a
PHP script ?
The default max execution time for PHP scripts is set
to 30 seconds. If a php script runs longer than 30
seconds then PHP stops the script and reports an
error.
You can increase the execution time by changing
max_execution_time directive in your php.ini file or
calling ini_set(‘max_execution_time’, 300); //300
seconds = 5 minutes function at the top of your php
script.
Online Interview Question
9. What is difference between strstr() and
stristr() ?
In PHP both functions are used to find the first occurrence of
substring in a string except
stristr() is case-insensitive and strstr is case-sensitive,if no
match is found then FALSE will be returned.
Sample Usage:
<?php $email = ‘abc@xyz.com’; $hostname = strstr($email,
‘@’); echo $hostname; output: @xyz.com stristr() does the
same thing in Case-insensitive manner ?>
Online Interview Question
10. How to Pass JSON Data in a URL
using CURL in PHP
Code to post JSON Data in a URL
using CURL in PHP
$url='http://onlineinterviewquestions.com/get_details';
$jsonData='{"name":"phpScots","email":"phpscots@onlineinter
viewquestions.com",'age':36}'; $ch = curl_init(); curl_setopt($ch,
CURLOPT_URL, $url); curl_setopt($ch,
CURLOPT_RETURNTRANSFER, 0); curl_setopt($ch,
CURLOPT_POSTFIELDS, $jsonData); curl_close($ch);
Online Interview Question
Thankyou for Reading
PHP Interview Question
Are you Fresher or Learner
visit us: online interview questions
Online Interview Question

More Related Content

What's hot (20)

Understanding PHP memory
Understanding PHP memoryUnderstanding PHP memory
Understanding PHP memory
 
Php(report)
Php(report)Php(report)
Php(report)
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
PHP Loops and PHP Forms
PHP  Loops and PHP FormsPHP  Loops and PHP Forms
PHP Loops and PHP Forms
 
Php, mysq lpart1
Php, mysq lpart1Php, mysq lpart1
Php, mysq lpart1
 
PHP Basic & Variables
PHP Basic & VariablesPHP Basic & Variables
PHP Basic & Variables
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
 
Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
PHP
PHPPHP
PHP
 
Pp
PpPp
Pp
 
Mysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extensionMysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extension
 
PHP 7 new engine
PHP 7 new enginePHP 7 new engine
PHP 7 new engine
 
PHP slides
PHP slidesPHP slides
PHP slides
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php tutorial
Php  tutorialPhp  tutorial
Php tutorial
 
PHP tutorial | ptutorial
PHP tutorial | ptutorialPHP tutorial | ptutorial
PHP tutorial | ptutorial
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Php and MySQL
Php and MySQLPhp and MySQL
Php and MySQL
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3
 

Similar to PHP Interview Questions-ppt

Similar to PHP Interview Questions-ppt (20)

Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview Questions
 
Php interview questions with answer
Php interview questions with answerPhp interview questions with answer
Php interview questions with answer
 
Unit 1
Unit 1Unit 1
Unit 1
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
php questions
php questions php questions
php questions
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Lecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdfLecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdf
 
Php basics
Php basicsPhp basics
Php basics
 
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPPHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHP
 
Php interview-questions and answers
Php interview-questions and answersPhp interview-questions and answers
Php interview-questions and answers
 
PHP Basics Ebook
PHP Basics EbookPHP Basics Ebook
PHP Basics Ebook
 
phptutorial
phptutorialphptutorial
phptutorial
 
phptutorial
phptutorialphptutorial
phptutorial
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php
PhpPhp
Php
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Php mysql training-in-mumbai
Php mysql training-in-mumbaiPhp mysql training-in-mumbai
Php mysql training-in-mumbai
 

More from Mayank Kumar

Devops interview-questions-PDF
Devops interview-questions-PDFDevops interview-questions-PDF
Devops interview-questions-PDFMayank Kumar
 
Junit Interview Questions-ppt
Junit Interview Questions-pptJunit Interview Questions-ppt
Junit Interview Questions-pptMayank Kumar
 
Linux interview questions-ppt
Linux interview questions-pptLinux interview questions-ppt
Linux interview questions-pptMayank Kumar
 
Struts interview-questions-ppt
Struts interview-questions-pptStruts interview-questions-ppt
Struts interview-questions-pptMayank Kumar
 
Core Java interview questions-ppt
Core Java interview questions-pptCore Java interview questions-ppt
Core Java interview questions-pptMayank Kumar
 
Tableau interview questions-ppt
 Tableau interview questions-ppt Tableau interview questions-ppt
Tableau interview questions-pptMayank Kumar
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview QuestionsMayank Kumar
 

More from Mayank Kumar (7)

Devops interview-questions-PDF
Devops interview-questions-PDFDevops interview-questions-PDF
Devops interview-questions-PDF
 
Junit Interview Questions-ppt
Junit Interview Questions-pptJunit Interview Questions-ppt
Junit Interview Questions-ppt
 
Linux interview questions-ppt
Linux interview questions-pptLinux interview questions-ppt
Linux interview questions-ppt
 
Struts interview-questions-ppt
Struts interview-questions-pptStruts interview-questions-ppt
Struts interview-questions-ppt
 
Core Java interview questions-ppt
Core Java interview questions-pptCore Java interview questions-ppt
Core Java interview questions-ppt
 
Tableau interview questions-ppt
 Tableau interview questions-ppt Tableau interview questions-ppt
Tableau interview questions-ppt
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
 

Recently uploaded

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 

Recently uploaded (20)

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

PHP Interview Questions-ppt

  • 2. 1. What is PHP ? PHP: Hypertext Preprocessor is open source server-side scripting language that is widely used for creation of dynamic web applications.It was developed by Rasmus Lerdorf also know as Father of PHP in 1994. PHP is a loosely typed language , we didn’t have to tell PHP which kind of Datatype a Variable is. PHP automatically converts the variable to the correct datatype , depending on its value. Online Interview Question
  • 3. 2. What is T_PAAMAYIM_NEKUDOTAYIM ? T_PAAMAYIM_NEKUDOTAYIM is scope resolution operator used as :: (double colon) .Basically it used to calling static methods/variables of a Class. Example usage:- $Cache::getConfig($key); Online Interview Question
  • 4. 3. What is the difference between = = and = = = operation PHP ? In PHP == is equal operator and returns TRUE if $a is equal to $b after type juggling and === is Identical operator and return TRUE if $a is equal to $b, and they are of the same data type. Example Usages: <?php $a=true ; $b=1; // Below condition returns true and prints a and b are equal if($a==$b){ echo "a and b are equal"; }else{ echo "a and b are not equal"; } //Below condition returns false and prints a and b are not equal because $a and $b are of different data types. if($a===$b){ echo "a and b are equal"; }else{ echo "a and b are not equal"; } ?> Online Interview Question
  • 5. 4. How to register a variable in PHP session ? In PHP 5.3 or below we can register a variable session_register() function.It is deprecated now and we can set directly a value in $_SESSION Global. Example usage: <?php // Starting session session_start(); // Use of session_register() is deprecated $username = "PhpScots"; session_register("username"); // Use of $_SESSION is preferred $_SESSION["username"] = "PhpScots"; ?> Also Read Laravel interview questions Online Interview Question
  • 6. 5. Where sessions stored in PHP ? PHP sessions are stored on server generally in text files in a temp directory of server. That file is not accessible from outside word. When we create a session PHP create a unique session id that is shared by client by creating cookie on clients browser.That session id is sent by client browser to server each time when a request is made and session is identified. The default session name is “PHPSESSID”. Online Interview Question
  • 7. 6. What is default session time and path in PHP. How to change it ? Default session time in PHP is 1440 seconds (24 minutes) and Default session storage path is temporary folder/tmp on server. You can change default session time by using below code. <?php // server should keep session data for AT LEAST 1 hour ini_set('session.gc_maxlifetime', 3600); // each client should remember their session id for EXACTLY 1 hour session_set_cookie_params(3600); ?> Online Interview Question
  • 8. 7. What are PHP Magic Methods/Functions. List them ? In PHP all functions starting with __ names are magical functions/methods. Magical methods always lives in a PHP class. The definition of magical function are defined by programmer itself. Here are list of magic functions available in PHP __construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state(), __clone() and __debugInfo() . Online Interview Question
  • 9. 8. How to increase the execution time of a PHP script ? The default max execution time for PHP scripts is set to 30 seconds. If a php script runs longer than 30 seconds then PHP stops the script and reports an error. You can increase the execution time by changing max_execution_time directive in your php.ini file or calling ini_set(‘max_execution_time’, 300); //300 seconds = 5 minutes function at the top of your php script. Online Interview Question
  • 10. 9. What is difference between strstr() and stristr() ? In PHP both functions are used to find the first occurrence of substring in a string except stristr() is case-insensitive and strstr is case-sensitive,if no match is found then FALSE will be returned. Sample Usage: <?php $email = ‘abc@xyz.com’; $hostname = strstr($email, ‘@’); echo $hostname; output: @xyz.com stristr() does the same thing in Case-insensitive manner ?> Online Interview Question
  • 11. 10. How to Pass JSON Data in a URL using CURL in PHP Code to post JSON Data in a URL using CURL in PHP $url='http://onlineinterviewquestions.com/get_details'; $jsonData='{"name":"phpScots","email":"phpscots@onlineinter viewquestions.com",'age':36}'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); curl_close($ch); Online Interview Question
  • 12. Thankyou for Reading PHP Interview Question Are you Fresher or Learner visit us: online interview questions Online Interview Question