SlideShare a Scribd company logo
1. Who is the father of PHP ?
Rasmus Lerdorf is known as the father of PHP.
2. What is the difference between $name and $$name?
$name is variable where as $$name is reference variable like
$name=sonia and $$name=singh so $sonia value is singh.
3. What are the method available in form submitting?
GET and POST
4.How can we get the browser properties using PHP?
<?php
echo $_SERVER[‘HTTP_USER_AGENT’].”nn”;
$browser=get_browser(null,true);
print_r($browser);
?>
5. What Is a Session?
A session is a logical object created by the PHP engine to allow you to
preserve data across subsequent HTTP requests. Sessions are commonly
used to store temporary data to allow multiple PHP pages to offer a
complete functional transaction for the same visitor.
6. How can we register the variables into a session?
<?php
session_register($ur_session_var);
?>
7. How many ways we can pass the variable through the navigation
between the pages?
Register the variable into the session
Pass the variable as a cookie
Pass the variable as part of the URL
8. How can we know the total number of elements of Array?
sizeof($array_var)
count($array_var)
9. How can we create a database using php?
mysql_create_db();
10. What is the functionality of the function strstr and stristr?
strstr() returns part of a given string from the first occurrence of a given
substring to the end of the string.
For example:strstr("user@example.com","@") will return
"@example.com".
stristr() is idential to strstr() except that it is case insensitive.
11. What are encryption functions in PHP?
CRYPT(), MD5()
12. How to store the uploaded file to the final location?
move_uploaded_file( string filename, string destination)
13. Explain mysql_error().
The mysql_error() message will tell us what was wrong with our query,
similar to the message we would receive at the MySQL console.
14. What is Constructors and Destructors?
CONSTRUCTOR : PHP allows developers to declare constructor
methods for classes. Classes which have a constructor method call this
method on each newly-created object, so it is suitable for any
initialization that the object may need before it is used.
DESTRUCTORS : PHP 5 introduces a destructor concept similar to that
of other object-oriented languages, such as C++. The destructor method
will be called as soon as all references to a particular object are removed
or when the object is explicitly destroyed or in any order in shutdown
sequence.
15. Explain the visibility of the property or method.
The visibility of a property or method must be defined by prefixing the
declaration with the keywords public, protected or private.
Class members declared public can be accessed everywhere.
Members declared protected can be accessed only within the class itself
and by inherited and parent classes.
Members declared as private may only be accessed by the class that
defines the member.
16. What are the differences between Get and post methods.
There are some defference between GET and POST method
1. GET Method have some limit like only 2Kb data able to send for
request
But in POST method unlimited data can we send
2. when we use GET method requested data show in url but
Not in POST method so POST method is good for send sensetive request
17. What are the differences between require and include?
Both include and require used to include a file but when included file not
found
Include send Warning where as Require send Fatal Error
18. What is use of header() function in php ?
The header() function sends a raw HTTP header to a client.We can use
herder()
function for redirection of pages. It is important to notice that header()
must
be called before any actual output is seen.
19. List out the predefined classes in PHP?
Directory
stdClass
__PHP_Incomplete_Class
exception
php_user_filter
20. What type of inheritance that PHP supports?
In PHP an extended class is always dependent on a single base class,that
is, multiple inheritance is not supported. Classes are extended using the
keyword 'extends'.
21. How can we encrypt the username and password using php?
You can encrypt a password with the following Mysql>SET
PASSWORD=PASSWORD("Password");
We can encode data using base64_encode($string) and can decode using
base64_decode($string);
22. What is the difference between explode and split?
Split function splits string into array by regular expression. Explode
splits a string into array by string.
For Example:explode(" and", "India and Pakistan and Srilanka");
split(" :", "India : Pakistan : Srilanka");
Both of these functions will return an array that contains India, Pakistan,
and Srilanka.
23. How do you define a constant?
Constants in PHP are defined using define() directive, like
define("MYCONSTANT", 100);
24. How do you pass a variable by value in PHP?
Just like in C++, put an ampersand in front of it, like $a = &$b;
25. What does a special set of tags <?= and ?> do in PHP?
The output is displayed directly to the browser.
26. How do you call a constructor for a parent class?
parent::constructor($value)
27. What’s the special meaning of __sleep and __wakeup?
__sleep returns the array of all the variables than need to be saved, while
__wakeup retrieves them.
28. What is the difference between PHP and JavaScript?
javascript is a client side scripting language, so javascript can make
popups and other things happens on someone’s PC. While PHP is server
side scripting language so it does every stuff with the server.
29. What is the difference between the functions unlink and unset?
unlink() deletes the given file from the file system.
unset() makes a variable undefined.
30. How many ways can we get the value of current session id?
session_id() returns the session id for the current session.
31. What are default session time and path?
default session time in PHP is 1440 seconds or 24 minutes
Default session save path id temporary folder /tmp
32. for image work which library?
we will need to compile PHP with the GD library of image functions for
this to work. GD and PHP may also require other libraries, depending on
which image formats you want to work with.
33. How can we get second of the current time using date function?
<?php
$second = date(“s”);
?>
34. What are the Formatting and Printing Strings available in PHP?
printf()- Displays a formatted string
sprintf()-Saves a formatted string in a variable
fprintf() -Prints a formatted string to a file
number_format()-Formats numbers as strings
35. How can we find the number of rows in a result set using PHP?
$result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows found";

More Related Content

PDF
Building Custom PHP Extensions
PPT
Php mysql training-in-mumbai
DOCX
Php advance
PPTX
PHP in one presentation
PDF
Mastering PHP - it's alive (1)
PDF
PPT
How PHP Works ?
Building Custom PHP Extensions
Php mysql training-in-mumbai
Php advance
PHP in one presentation
Mastering PHP - it's alive (1)
How PHP Works ?

What's hot (20)

PDF
Apache Thrift
PPT
PHP Interview Questions-ppt
PDF
The state of DI - DPC12
PPTX
Php.ppt
PDF
Nette framework (WebElement #28)
PPT
Introduction to Thrift
PPTX
Php presentation
PDF
tutorial54
PPTX
Sphinx autodoc - automated API documentation (EuroPython 2015 in Bilbao)
PPT
PHP - Introduction to PHP Fundamentals
PDF
[4developers2016] PHP 7 (Michał Pipa)
PDF
The state of DI in PHP - phpbnl12
PPT
Php Tutorial
PDF
Understanding PHP objects
PDF
Introduction to PHP
PDF
Create your own PHP extension, step by step - phpDay 2012 Verona
PDF
Quick tour of PHP from inside
PDF
PHP7 is coming
Apache Thrift
PHP Interview Questions-ppt
The state of DI - DPC12
Php.ppt
Nette framework (WebElement #28)
Introduction to Thrift
Php presentation
tutorial54
Sphinx autodoc - automated API documentation (EuroPython 2015 in Bilbao)
PHP - Introduction to PHP Fundamentals
[4developers2016] PHP 7 (Michał Pipa)
The state of DI in PHP - phpbnl12
Php Tutorial
Understanding PHP objects
Introduction to PHP
Create your own PHP extension, step by step - phpDay 2012 Verona
Quick tour of PHP from inside
PHP7 is coming
Ad

Viewers also liked (16)

PDF
Condor_Group_Enterprises
PPT
Condor Security Training
PDF
Award, Gift and Tax - 10082015
PPTX
Samenwerking multipartners
PPTX
Training Meldkamer MWB
PPTX
Curve van ellende
PPTX
Passende brandweerzorg bij automatische meldingen VOOR DE VEILIGHEIDSREGIO
PPTX
Articles Do Provide!
PDF
Tinea kruris zilla
PPTX
Hari kantin sekolah
PPTX
A PROJECT REPORT ON BELT WATCH SYSTEM FOR
PPTX
Referencing made easy
PPTX
partition of pakistan india
PPTX
MULTILEVEL INVERTER AND NEURAL NETWORK INTRODUCTION
PDF
Incident met zonnepanelen
PDF
Multilevel inverter fault detectiion classification and diagnosis
Condor_Group_Enterprises
Condor Security Training
Award, Gift and Tax - 10082015
Samenwerking multipartners
Training Meldkamer MWB
Curve van ellende
Passende brandweerzorg bij automatische meldingen VOOR DE VEILIGHEIDSREGIO
Articles Do Provide!
Tinea kruris zilla
Hari kantin sekolah
A PROJECT REPORT ON BELT WATCH SYSTEM FOR
Referencing made easy
partition of pakistan india
MULTILEVEL INVERTER AND NEURAL NETWORK INTRODUCTION
Incident met zonnepanelen
Multilevel inverter fault detectiion classification and diagnosis
Ad

Similar to php questions (20)

PDF
Php interview questions with answer
DOCX
Php interview questions
DOCX
Php interview questions
PPTX
PHP Interview Questions for Freshers 2018
PDF
PDF
Php interview questions
DOC
Oss questions
PDF
PHP Reviewer
DOCX
web design and development.docx
PDF
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
PPTX
Unit 4-6 sem 7 Web Technologies.pptx
PPTX
PHP Interview Questions
DOCX
100 PHP question and answer
PPTX
Introduction to PHP OOP
PDF
Top 100 PHP Interview Questions and Answers
PDF
Php Interview Questions
PDF
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
PDF
Top 100 PHP Questions and Answers
DOCX
1000+ php questions
PDF
501 - PHP MYSQL.pdf
Php interview questions with answer
Php interview questions
Php interview questions
PHP Interview Questions for Freshers 2018
Php interview questions
Oss questions
PHP Reviewer
web design and development.docx
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Unit 4-6 sem 7 Web Technologies.pptx
PHP Interview Questions
100 PHP question and answer
Introduction to PHP OOP
Top 100 PHP Interview Questions and Answers
Php Interview Questions
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100 PHP Questions and Answers
1000+ php questions
501 - PHP MYSQL.pdf

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Nekopoi APK 2025 free lastest update
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
AI in Product Development-omnex systems
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
medical staffing services at VALiNTRY
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
Odoo Companies in India – Driving Business Transformation.pdf
Design an Analysis of Algorithms II-SECS-1021-03
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PTS Company Brochure 2025 (1).pdf.......
Nekopoi APK 2025 free lastest update
Odoo POS Development Services by CandidRoot Solutions
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Reimagine Home Health with the Power of Agentic AI​
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
AI in Product Development-omnex systems
How to Migrate SBCGlobal Email to Yahoo Easily
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Upgrade and Innovation Strategies for SAP ERP Customers
CHAPTER 2 - PM Management and IT Context
Softaken Excel to vCard Converter Software.pdf
medical staffing services at VALiNTRY
2025 Textile ERP Trends: SAP, Odoo & Oracle

php questions

  • 1. 1. Who is the father of PHP ? Rasmus Lerdorf is known as the father of PHP. 2. What is the difference between $name and $$name? $name is variable where as $$name is reference variable like $name=sonia and $$name=singh so $sonia value is singh. 3. What are the method available in form submitting? GET and POST 4.How can we get the browser properties using PHP? <?php echo $_SERVER[‘HTTP_USER_AGENT’].”nn”; $browser=get_browser(null,true); print_r($browser); ?> 5. What Is a Session? A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor. 6. How can we register the variables into a session? <?php session_register($ur_session_var); ?> 7. How many ways we can pass the variable through the navigation between the pages? Register the variable into the session Pass the variable as a cookie Pass the variable as part of the URL
  • 2. 8. How can we know the total number of elements of Array? sizeof($array_var) count($array_var) 9. How can we create a database using php? mysql_create_db(); 10. What is the functionality of the function strstr and stristr? strstr() returns part of a given string from the first occurrence of a given substring to the end of the string. For example:strstr("user@example.com","@") will return "@example.com". stristr() is idential to strstr() except that it is case insensitive. 11. What are encryption functions in PHP? CRYPT(), MD5() 12. How to store the uploaded file to the final location? move_uploaded_file( string filename, string destination) 13. Explain mysql_error(). The mysql_error() message will tell us what was wrong with our query, similar to the message we would receive at the MySQL console. 14. What is Constructors and Destructors? CONSTRUCTOR : PHP allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used. DESTRUCTORS : PHP 5 introduces a destructor concept similar to that
  • 3. of other object-oriented languages, such as C++. The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence. 15. Explain the visibility of the property or method. The visibility of a property or method must be defined by prefixing the declaration with the keywords public, protected or private. Class members declared public can be accessed everywhere. Members declared protected can be accessed only within the class itself and by inherited and parent classes. Members declared as private may only be accessed by the class that defines the member. 16. What are the differences between Get and post methods. There are some defference between GET and POST method 1. GET Method have some limit like only 2Kb data able to send for request But in POST method unlimited data can we send 2. when we use GET method requested data show in url but Not in POST method so POST method is good for send sensetive request 17. What are the differences between require and include? Both include and require used to include a file but when included file not found Include send Warning where as Require send Fatal Error 18. What is use of header() function in php ? The header() function sends a raw HTTP header to a client.We can use herder() function for redirection of pages. It is important to notice that header() must be called before any actual output is seen. 19. List out the predefined classes in PHP?
  • 4. Directory stdClass __PHP_Incomplete_Class exception php_user_filter 20. What type of inheritance that PHP supports? In PHP an extended class is always dependent on a single base class,that is, multiple inheritance is not supported. Classes are extended using the keyword 'extends'. 21. How can we encrypt the username and password using php? You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD("Password"); We can encode data using base64_encode($string) and can decode using base64_decode($string); 22. What is the difference between explode and split? Split function splits string into array by regular expression. Explode splits a string into array by string. For Example:explode(" and", "India and Pakistan and Srilanka"); split(" :", "India : Pakistan : Srilanka"); Both of these functions will return an array that contains India, Pakistan, and Srilanka. 23. How do you define a constant? Constants in PHP are defined using define() directive, like define("MYCONSTANT", 100); 24. How do you pass a variable by value in PHP? Just like in C++, put an ampersand in front of it, like $a = &$b; 25. What does a special set of tags <?= and ?> do in PHP? The output is displayed directly to the browser.
  • 5. 26. How do you call a constructor for a parent class? parent::constructor($value) 27. What’s the special meaning of __sleep and __wakeup? __sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them. 28. What is the difference between PHP and JavaScript? javascript is a client side scripting language, so javascript can make popups and other things happens on someone’s PC. While PHP is server side scripting language so it does every stuff with the server. 29. What is the difference between the functions unlink and unset? unlink() deletes the given file from the file system. unset() makes a variable undefined. 30. How many ways can we get the value of current session id? session_id() returns the session id for the current session. 31. What are default session time and path? default session time in PHP is 1440 seconds or 24 minutes Default session save path id temporary folder /tmp 32. for image work which library? we will need to compile PHP with the GD library of image functions for this to work. GD and PHP may also require other libraries, depending on which image formats you want to work with. 33. How can we get second of the current time using date function? <?php $second = date(“s”); ?>
  • 6. 34. What are the Formatting and Printing Strings available in PHP? printf()- Displays a formatted string sprintf()-Saves a formatted string in a variable fprintf() -Prints a formatted string to a file number_format()-Formats numbers as strings 35. How can we find the number of rows in a result set using PHP? $result = mysql_query($sql, $db_link); $num_rows = mysql_num_rows($result); echo "$num_rows rows found";