Syntax Oddity

From: Date: Tue, 02 May 2006 08:18:05 +0000
Subject: Syntax Oddity
Groups: php.general 
Request: Send a blank email to php-general+get-235240@lists.php.net to get a copy of this message
Does anybody have a rational explanation for what purpose in life the following syntax is considered acceptable? <?php $query = "UPDATE whatever SET x = 1"; $query; ?> Note that the line with just $query; on it doesn't, like, "do" anything. I suppose in a Zen-like sort of way, it "exists" and all, but, really, what's the point? Is there some subtle reason for this not being some kind of syntax error that's way over my head or something? This is not just philosophical minutiae -- Real-world beginners, with no programming experience, actually type the above (albeit with a lot more logic and whatnot in between) and then wonder why the query didn't execute. It even makes a wild sort of sense to type that, if you presume that a beginner might not grasp the distinctions between PHP and MySQL and the relationship yet. Does anybody actually USE this idiom in any meaningful way? <?php "string"; ?> -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#235240) next »