Reply to Re: I am stuck: Error on a line that begins with the word "const" !!

Your name:

Reply:


Posted by J.O. Aho on 12/08/07 05:27

adam.timberlake@gmail.com wrote:

> My server is CentOS 4 or 5, I forget which,

cat /etc/issue
That should tell you a bit about which version you are using


> running PHP 4.1.0 with
> MySQL 5, I think. The line that it shows me the error on is:

This makes me believe it's NOT CentOS5.


> const OPT_FILE = 'talkphp_conversion_rates.json';
> Parse error: parse error, expecting `T_OLD_FUNCTION' or
> `T_FUNCTION'...

const can only be used in a class, so

<?PHP
const OPT_FILE = 'talkphp_conversion_rates.json';
?>

will genereate your error message

<?PHP
class something {
const OPT_FILE = 'talkphp_conversion_rates.json';
}
?>

This would be ok.

If you want to use a "constatn" outside a class, you have to use define as
Jerry suggested.


--

//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация