Error on page

From: Date: Sat, 24 May 2008 17:31:32 +0000
Subject: Error on page
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-1810@lists.php.net to get a copy of this message
Concerning: http://us3.php.net/manual/en/language.types.string.php I was reading through to learn PHP basics before starting my new job, and I found the following section: |<?php| |$beer = 'Heineken';| |echo "$beer's taste is great"; // works; "'" is an invalid character for variable names| |echo "He drank some $beers"; // won't work; 's' is a valid character for variable names| |echo "He drank some ${beer}s"; // works| |echo "He drank some {$beer}s"; // works| |?>| || | |I think this should actually be:| | |<?php| |$beer = 'Heineken';| |echo "$beer's taste is great"; // won't work; "'" is an invalid character for variable names| |echo "He drank some $beers"; // works; 's' is a valid character for variable names| |echo "He drank some ${beer}s"; // works| |echo "He drank some {$beer}s"; // works| |?>| || || I'm going to be messing with the curly braced variables on my home computer, since it seems counterintuitive (to me) that {}'s can be used like that (especially as shown in the fourth line). Thanks for the awesome tutorial :) -Q

« previous php.webmaster (#1810) next »