What is
PHP?
PHP is a
server side scripting language commonly used for web applications
How to
include a file to a php page?
we can
include a file using "include() " or "require()" function
with as its parameter.
What's the difference between include and require?
If the
file is not found by require(), it will cause a fatal error and halt the
execution of the script. If the file is not found by include(), a warning will
be issued, but execution will continue.
require_once(),
require(), include().What is difference between them?
require()
includes and evaluates a specific file, while require_once() does that only if
it has not been included before (on the same page). So, require_once() is
recommended to use when you want to include a file where you have a lot of
functions for example. This way you make sure you don't include the file more
times and you will not get the "function re-declared" error.
How do you
define a constant?
Using
define() directive, like define ("MYCONSTANT",150)
What Is a
Session?
It can be
used to store information on the server for future use
How to set
cookies in PHP?
Cookies
are often used to track user information Syntax: Setcookie(name, value, expire,
path, domain); eg:Setcookie($sample, $ram, time()+3600);
Difference
between mysql_connect and mysql_pconnect?
There is a
good page in the php manual on the subject, in short mysql_pconnect() makes a
persistent connection to the database which means a SQL link that do not close
when the execution of your script ends. mysql_connect()provides only for the
databasenewconnection while using mysql_pconnect , the function would first try
to find a (persistent) link that's already open with the same host, username
and password. If one is found, an identifier for it will be returned instead of
opening a new connection... the connection to the SQL server will not be closed
when the execution of the script ends. Instead, the link will remain open for
future use.
How to
create a mysql connection?
mysql_connect(servername,username,password);
How to
open a file?
fopen();
what is the
use of mysql_fetch_array() function in php ?
This
function returns a row from the table as an associative array or numeric array.
Write down
the code for upload a file in php..
0) { echo
“Error: ” . $_FILES["file"]["error"] . “
”; } else {
echo “Upload: ” . $_FILES["file"]["name"] . “
”; echo
“Type: ” . $_FILES["file"]["type"] . “
”; echo
“Size: ” . ($_FILES["file"]["size"] / 1024) . ” Kb
”; echo
“Stored in: ” . $_FILES["file"]["tmp_name"]; } ?>
what is the
use of the function " explode() " in php?
This
function is used to split a string by special character or symbol in the
string, we must be pass the string and splitting character as parameter into
the function.
What is use
of in_array() function in php ?
in_array used
to checks if a value exists in an array
How to
retrieve the data from MySQL result set ?
using the
methods given below 1. mysql_fetch_row. 2. mysql_fetch_array 3.
mysql_fetch_object 4. mysql_fetch_assoc
differences
between GET and POST methods ?
We can send
1024 bytes using GET method but POST method can transfer large amount of data
and POST is the secure method than GET method .
What is SSL
?
SSL stands
for Secure Sockets Layer. This is a cryptographic protocols which provide
secure communications on the Internet
How to
calculate the sum of values in an array ?
"array_sum"
method used for calculate sum of values in an array
What is the
use of "ksort" in php?
No comments:
Post a Comment