PHP interview Question Part-1
|
1) What is the difference between
"echo" and "print" in PHP?
Print is not a constructor whereas echo is a constructor.
Print can take argument whereas with echo it is doesn’t support
to take arguments.
2) Which will execute faster POST or GET? Explain
POST is much secured when compared to the GET method.
Since it as secured method it require to pass more test then the normal GET
method.
3) what are the new features that are added in PHP5?
1) PHP5 introduces SPL that provide a range of classes and
interface.
2) Contains access modifier.
3) It offers built in interface in addition to built in
class.
4) It support OOPS concept.
4) What is the purpose of ob_start() ?
OB_start() turn on the output buffer. While the
buffer is on, no output is sent rather it is stored in the internal buffer.
Inorder to get content from output Ob_get_content function can be used.
5) How to call C function within PHP?
Not all C function can be called to PHP. Function
such as fputs() fgetc() fwrite() exit() printf().
6) what is the use of header function in PHP?
The main purpose of the header function is that it
redirect to the file that contains the information. More then this sometime
header file are also responsible for authentication.
7 ) What is difference between require_once(), require(), include().
Because above three function usually use to call a file in
another file.
require() produces a FATAL ERROR, if the file you want to
include is not found.
include() just send a warining msg.
8) While in case of download, How will you make a percentage bar showing
current status of total 100%?
Following procedure help to show the processing bar while
download
Percentage can be displayed using image
Changing the width will help to change depending on the
process completed.
9) Where does the session stored, either client side or server side?
PHP Session is used to maintain client's previous state
and the session is stored on the server side.
10) Can you submit a form without using submit button ? If Yes, How?
If you don't want to use the Submit button to submit a
form, you can use normal hyper links to submit a form. But you need to use
some JavaScript code in the URL of the link.
11) How do you upload videos using PHP & MySQL?
For uploading videos you need not store the video in
database. Just you store the video path in database. You store the videos in
a separate folder like video_uploads. After uploading you can call those
videos from the video_uploads folder via MySQL ie the path is already stored
in database. And one more thing if the file size is more than 2MB the file is
not successfully uploaded. For that you need to change the max_file size in
php.ini file.
12) How to access crystal reports through PHP code
1. If you run PHP on Windows, call Crystal Reports as a
COM object.
2. Regardless of your OS, you should still be able to use
Crystal Reports Web services and for this you may have to use NuSOAP to access
and utilized these service..
13) What is pear in PHP?
PEAR stands for PHP Extension And Repository. It is an
advancement of the script. This help to develop better code that accompany
more features.
14) How can I use the COM components in php?
$obj1Com = new COM(“AddNumber.math”);
$res = $obj1Com ->AddNum(2,2);
echo $res;
?>
15) How can I execute a PHP script using command line?
PHP script using command line can be executed using SAPI
(Server Application programming Interface). Using SAPI
Command Line Interface the PHP code can be passed to
execute
directly
Example:
Php –r ‘print_r(get_defined_constanrs());’
16) What are the different types of Errors in PHP?
17) What is meant by nl2br()?
Nl2br() stands for next line to break tag.
18) What is PHP?
PHP is a server side scripting language, is simple and
powerful to create a dynamic web page.
19) How can we convert the time zones using PHP?
Converting the tie zone can be done using the following
syntax. date_default_timezone_set function on PHP 5.1.0
20) What is meant by urlencode and urldocode?
urlencode(): encode url
urldecode(): decode encoded url to original form
21) How to get the session id in PHP?
Inorder to get the current session ID the following syntax
can be used
Session_id()
22) Name some of the functions in IMAP and LDAP?
IMAP function:- (Internet Message Access protocol)
imap_open
imap_list
LDAP function:- (Light weight Directory Access protocol)
ldap_search
ldap_connect
24) How can we encrypt the username and password using PHP?
It is possible to encrypt the username and
password using base64_encode().
25) What is the PHP predefined variable that tells the What types of
images that PHP supports?
PHP provides a large number of predefined
variables to all scripts. The variables represent everything from external
variables to built-in environment variables, last error messages to last
retrieved headers.
|
---------------------------------------------------------------------------------
Posted By Sundeep aka SunTechie
Sundeep is a Founder of Youth Talent Auzzar, a passionate blogger, a programmer, a developer, CISE and these days he is pursuing his graduation in Engineering with Computer Science dept.
Add Sundeep as a Friend on
No comments:
Post a Comment