PHP Questions
PHP Questions
PHP Questions
Here is some PHP Interview Questions, that will helpfull to PHP Interview Candidates
1. What is CAPTCHA?
CAPTCHA stands for Completely Automated Public Turing Test to tell Computers and
Humans Apart. To prevent spammers from using bots to automatically fill out forms,
CAPTCHA programmers will generate an image containing distorted images of a string
of numbers and letters. Computers cannot determine what the numbers and letters are
from the image but humans have great pattern recognition abilities and will be able to
fairly accurately determine the string of numbers and letters. By entering the numbers
and letters from the image in the validation field, the application can be fairly assured
that there is a human client using it. To read more look here:
http://en.wikipedia.org/wiki/Captcha
3. If you have to work with dates in the following format: "Tuesday, February 14, 2006
@ 10:39 am", how can you convert them to another format, that is easier to use?
So we have
$date = str_replace("@ ","",$date);
$date = strtotime($date);
Templateshut.com
now $date is a timestamp
and we can say:
get_browser() attempts to determine the capabilities of the user's browser. This is done
by looking up the browser's information in the browscap.ini file.
$browser = get_browser();
5. How i will check that user is, logged in or not. i want to make it a function and i want
to use in each page and after login i want to go in current page(same page. where i was
working)?
For this we can use the session objec($_SESSION)t. When the user login with his/ her
user name and password, usually we check those to ensure for correctness. If that user
name and password are valid one then we can store that user name in a session and
then we can very that session variable has been set or not in a single files and we can
include that file in all pages.
Templateshut.com
only time you need to close the connection manually is if you jump out of the script for
any reason.
If you do use mysql_pconnect. You only need to call it once for the session. That's the
beauty of it. It will hold open a connection to the db that you can use over and over
again simply by calling the resource ID whenever you need to interact with the db.
There is a slight difference between print and echo which would depend on how you
want to use the outcome. Using the print method can return a true/false value. This may
be helpful during a script execution of somesort. Echo does not return a value, but has
been considered as a faster executed command. All this can get into a rather
complicated discussion, so for now, you can just use whichever one you prefer.
9. How to make a download page in own site, which i can know that how many file has
been loaded by particular user or particular ipaddress?
We can use hyperlink having URL where file are kept. and we only allow regisetered
user to download. from session of user we can get the user detail
Templateshut.com