Basic PHP Programming Questions and Answers
Download PHP eBook

Download PDF Download PHP Questions eBook

PHP Questions and Answers: Submit Your Question

1 :: How to use cryptographic security in php?

No Answer is Posted For this Question
Be the First to add answer.
Post Your Answer Now

2 :: How To Read the Entire File into a Single String?

If you have a file, and you want to read the entire file into a single string, you can use the file_get_contents() function. It opens the specified file, reads all characters in the file, and returns them in a single string. Here is a PHP script example on how to file_get_contents():

$file = file_get_contents("/windows/system32/drivers/etc/services");
print("Size of the file: ".strlen($file)."n");

This script will print:

Size of the file: 7116
Is This Answer Correct?    11 Yes 4 No
Submit Your Answer

3 :: How many ways can we get the value of current session id?

session_id() returns the session id for the current session.
Is This Answer Correct?    19 Yes 2 No
Submit Your Answer

4 :: What is the difference between include and require?

It’s how they handle failures. 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.
Is This Answer Correct?    17 Yes 0 No
Submit Your Answer

5 :: Explain the ternary conditional operator in PHP?

Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.
Is This Answer Correct?    15 Yes 1 No
Submit Your Answer

Place Your Question