Line By Lile Compilation

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
anjusb
Forum Newbie
Posts: 1
Joined: Tue Dec 09, 2008 11:32 pm

Line By Lile Compilation

Post by anjusb »

How Can we compile line by line in php. :crazy:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Line By Lile Compilation

Post 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:~$
 
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Line By Lile Compilation

Post by Ambush Commander »

You could also emulate it with eval(), although I'm not sure how you'd handle multiline statements.
Post Reply