Page 1 of 1

Line By Lile Compilation

Posted: Tue Dec 09, 2008 11:46 pm
by anjusb
How Can we compile line by line in php. :crazy:

Re: Line By Lile Compilation

Posted: Wed Dec 10, 2008 5:11 am
by Chris Corbyn
You can't compile line by line as such since expressions can run over several lines, but if you're looking for a console environment you can run PHP on the command line in interactive mode. Example (using "php -a"):

Code: Select all

 
d11wtq@w3style.co.uk:~$ php -a
Interactive shell
 
php > $foo = "bar";
php > function sayTwice($term) {
php { echo str_repeat($term, 2);
php { }
php > sayTwice($foo);
barbar
php > exit();
d11wtq@w3style.co.uk:~$
 

Re: Line By Lile Compilation

Posted: Sun Dec 28, 2008 10:50 pm
by Ambush Commander
You could also emulate it with eval(), although I'm not sure how you'd handle multiline statements.