The stripslashes function enables us to remove the escape characters before apostrophes in a string
Basic Questions
This category contains the most basic PHP questions
What is the difference between echo and print statement?
Echo() can take multiple expressions,Print cannot take multiple expressions.
Print return true or false based on success or failure whereas echo just does what its told without letting you know whether or not it worked properly.
How do you get the user’s ip address in PHP?
Using the server variable: $_SERVER[‘REMOTE_ADDR’]
What is the difference between include and require?
If you require a file and it cannot be found, the script will terminate with a fatal error. If you use include then you will get an error but the script will continue to execute. Therefore when the information you wish to reference from another file is essential to the correct running of a page, use require.
How can we increase the execution time of a php script?
Set max_execution_time variable in php.ini file to your desired time in second.
What is the maximum size of a file that can be uploaded using php and how can we change this?
You can change maximum size of a file set upload_max_filesize variable in php.ini file. Any other method
What is the difference between the functions unlink and unset?
Unlink() deletes the given file from the file system.
unset() makes a variable undefined.
What is the functionality of the function htmlentities?
htmlentities Convert all applicable characters to HTML entities
This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.
Mention two ways to count/number of elements of an array?
a) sizeof($urarray) This function is an alias of count()
b) count($urarray)
interestingly if u just pass a simple var instead of a an array it will return 1.