=,==,=== – what is the difference between these?
= assigns a value, == checks if value is the same, === checks if value is the same and the variables are of the exact same type.
Echo, print, printf – what is the difference between these?
Print and echo both output what is passed to them. Print acts like a function, so you can use it in complex statements. Printf is used to format the output.
Include, include once, require – what is the difference between these?
Include will includes a file each time it is called. Include_once would only include a file one time, so if a php program has a file in two include_once statements only the first will be done. Requre is like include, but if the file included is not available a fatal error occurs and processing stops.
Are variables passed to functions by reference or value?
A variable is passed by value unless the variable is passed with an &, such as functionName(&$variableName)
How do you encrypt data?
The PHP md5() function is very pretty widely used. The PHP crypt() function can also be used to encrypt data. (Honestly, the one time I had this question I drew a complete blank, so I’m not exactly certain what they were looking for.)
What editor or ide do you use?
Interesting question, probably does say something about your programming capabilites. use Eclipse 3.1 with PHP extensions, , Zend Studio Serious Unix users would be good with vi or emacs.
PHP Static, what are they and how do you use them?
As with Java, if the job is for OO PHP (that is PHP 5), there will be a question on PHP static variables. You may be asked how to reference a static from inside and outside of the class it is in, or just show that you get the basic concept of a variable or function that is for the whole class and not an instance.
Design Patterns general questions
Now we are really into OO stuff. As in java job interviews I’ve usually been asked about design patterns in fairly vague terms, such as “describe the design patterns used in the systems you have worked on”. I was asked that so much that I drew out some UML to bring with me to interviews, as I found drawing up the UML during the interview to be distracting and slow.
How can I maintain the count of how many persons have hit my site?
The IP of a visitor can be tracked by
$ip = $_SERVER[‘REMOTE_ADDR’];
Just insert this value with date into a table.
What is difference between mysql_fetch_array(), mysql_fetch_row() and mysql_fetch_object()?
mysql_fetch_array()– Fetche resultset from a table in the form of array
Eg: $res= mysql_query(’select * from tbl’)
Fetch single row
Fetches resultset as object
How I can make a chat page in php in simple
On click on chat submit button store the values in the text area to a text file using PHP file functions.
you can use ajax fore improved user experiance.
What is the difference between echo and print statement?
Print is a function and returns a value. Using echo we can use more than one parameter
echo “and a “, 1, 2, 3;
What is differenc between mysql_connect and mysql_pconnect?
mysql_connect- Creates a connection with db
mysql_pconnect- creates a persistant connection with db
How I can get IP address of the user?
)$ip = $_SERVER[‘REMOTE_ADDR’];
How I will check that user is logged in or not?
store user information in session
I want to make it a function and I want to use it in each page and after login I want to go in current page?
)store url in a variable and put in session before
After login redirect page to that url
How do we know browser properties?
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?
first remove @ from the string and than use strtime to convert this to unix time stamp.
What is difference between require_once(), require(), include()?
all are for including afile into another file
require- if fails shoot a fatal error
include- if fails shoot a warning
include/require_once- for make sure that the page is included once in another page