Re: [PHP4BETA] PHP 3 syntax imcompatibilities

From: Date: Mon, 20 Dec 1999 05:18:12 +0000
Subject: Re: [PHP4BETA] PHP 3 syntax imcompatibilities
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-8197@lists.php.net to get a copy of this message
"{$foo}" in PHP 4.0 is the same as "$foo", that is the root of your problems (this is to enable complex expressions inside quotes, e.g. "{$foo["bar"][2*3+7][$testing[123]]}", etc.). In PHP 3.0, the same syntax would have resulted in the contents of $foo, enclosed in curly braces. To obtain the same effect on 4.0, you must escape either the dollar or the curly braces:
"\{$foo}"               -> { [contents_of_$foo] }
"{\$foo}"               -> the string {$foo}
Zeev At 00:08 20/12/1999 , Manuel Lemos wrote:
Hello, Recently I was brought to the attention that there are some syntax problems in my forms class that hundreds of users have downloaded from here: http://phpclasses.UpperDesign.com/browse.html/package/1 The problem is that I am not sure what exactly uses on it syntax that was legal on PHP 3 but is not legal at least in PHP 4 beta 3. I have pasted the part of the code that apparently offend the PHP 4 syntax. I wonder if anybody can tell me what and why I can't use this syntax in PHP 4 despite I could in PHP 3. $function("function $validate_as_email(theinput)$jseol{$jseol"); $function("\ts=theinput.value$jseol\tif(s.search)$jseol\t{$jseol\t\treturn (s.search(new RegExp(\"".$this->EscapeJavascriptRegularExpressions($this->email_regular_e xpression)."\",\"gi\"))>=0)$jseol\t}$jseol"); $function("\tif(s.indexOf)$jseol\t{$jseol\t\tat_character=s.indexOf('@')$js eol\t\tif(at_character<=0 || at_character+4>s.length)$jseol\t\t\treturn false$jseol\t}$jseol"); $function("\tif(s.length<6)$jseol\t\treturn false$jseol\telse$jseol\t\treturn true$jseol}$jseol"); Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp -- -- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net For additional commands, e-mail: php4beta-help@lists.php.net To contact the list administrators, e-mail: php4beta-admin@lists.php.net
-- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.version4 (#8197) next »