PHP interview questions


Total available count: 33
Subject - PHP Frameworks
Subsubject - PHP

How to execute a PHP script using command line?

Run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument.

To run php interactively: (so you can paste/write code in the console)

php -a

To make it parse file and output to console:

php -f file.php

Parse file and output to another file:

php -f file.php > reults.html

Do you need something else? To run only small part, one line or like, you can use:

php -r '$x = "Slightbook"; echo "$x\n";'

If you are running linux then do man php at console.




Next 5 interview question(s)

1
PHP supports 8 primitive types. What are they?
2
What are Autoloading classes?
3
What are Classes?
4
What are Magic constants?
5
What are Objects?


Comments