php5/quotes/reserved words episode II
| From: | mel list_php | Date: | Wed, 16 Mar 2005 11:14:47 +0000 |
| Subject: | php5/quotes/reserved words episode II | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38926@lists.php.net to get a copy of this message | ||
I found some information on pear:
[2004-08-17 13:53 UTC] troy at versiontwo dot com dot au
I could only find a list of reserved words for php4. However, I can
assure you that the following words are now reserved for php5: try,
catch, throw, exception, public, private, protected, abstract,
interface and final.
Example:
class TryTest {
private $value;
public function __construct($someValue) {
$this->try($someValue);
}
private function try($value) {
$this->value = $value;
}
}
$tt = new TryTest('Test');
Causes the following error:
Parse error: parse error, unexpected T_TRY, expecting T_STRING
So the reason of my error is really the private which has became a reserved word.
Does the protection with "" in the brackets will be enough?
can I still use $private as a variable name or do I have to change that as well?
Any idea on where to find the list? and a list of all the changes with php5? I also found by chance that file_exists will now accept url, and that it could be a problem with include.
I would like to know if somebody made a kind of global list on " what to be careful about when you change to php5", or if somebody has some has encountered other problems that I should be aware?
I just found that page:
http://docs.php.net/en/migration5.html#migration5.changes
Thanks for your help and time.
ps:This may now be off-topic, I sent the first message here because it's mysql related (I need to find a correct syntax to avoid that kind of issues!!), so I just wanted to go on here.
_________________________________________________________________
Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger