note 28692 rejected from language.types.string by tix

From: Date: Tue, 21 Jan 2003 07:23:40 +0000
Subject: note 28692 rejected from language.types.string by tix
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-42508@lists.php.net to get a copy of this message
Shouldn't this : echo "$beer's taste is great"; // works, "'" is an invalid character for varnames echo "He drank some $beers"; // , 's' is a valid character for varnames echo "He drank some ${beer}s"; // works be like that: echo "$beer's taste is great"; // won't work, "'" is an invalid character for varnames echo "He drank some $beers"; // works, 's' is a valid character for varnames echo "He drank some ${beer}s"; // works No the way it is above is true. The author is not stressing the point that an 's' can be used in a variable and a ' cannot (which is true), the author is stressing the point that the ' in $beer's marks the end of the variable ->therefore forcing PHP to read the variable $beer (which was called above). However in the second case, because 's' is a valid variable character, PHP reads the variable as $beers which was not called above. Hence the explanation - but a good thought I saw it that way too at first. By the way this is my first day working at PHP and I think it's great!

« previous php.notes (#42508) next »