Connecting Tech Pros Worldwide Forums | Help | Site Map

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

adam.timberlake@gmail.com
Guest
 
Posts: n/a
#1: Dec 8 '07
Me again! I am trying to create a currency converter function for my
eCommerce that still pet treats. I am a little short on money recently
and so cannot afford a programmer. Can somebody tell me why my script
tells me that I have a syntax error on the "CONST" line. I am trying
to follow the article below.

Article: http://www.talkphp.com/showthread.php?t=1503

The error I get is:

Parse error: parse error, expecting `T_OLD_FUNCTION' or
`T_FUNCTION'...

My server is CentOS 4 or 5, I forget which, running PHP 4.1.0 with
MySQL 5, I think. The line that it shows me the error on is:

const OPT_FILE = 'talkphp_conversion_rates.json';

Please help! Also, somebody mentioned something about cross-posting on
newsgroups so that I can post to more than 1 group in case I do not
get a good answer in 1. Could somebody tell me how to do this with
Google Groups please!!

Thannk you.

Rik Wasmus
Guest
 
Posts: n/a
#2: Dec 8 '07

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


On Sat, 08 Dec 2007 01:57:49 +0100, <adam.timberlake@gmail.comwrote:
Quote:
Me again! I am trying to create a currency converter function for my
eCommerce that still pet treats. I am a little short on money recently
and so cannot afford a programmer. Can somebody tell me why my script
tells me that I have a syntax error on the "CONST" line. I am trying
to follow the article below.
>
Article: http://www.talkphp.com/showthread.php?t=1503
>
The error I get is:
>
Parse error: parse error, expecting `T_OLD_FUNCTION' or
`T_FUNCTION'...
>
My server is CentOS 4 or 5, I forget which, running PHP 4.1.0 with
MySQL 5, I think. The line that it shows me the error on is:
>
const OPT_FILE = 'talkphp_conversion_rates.json';
A class 'const' is not possible in PHP4, the same goes for
'private'/'public'/'protected' class variables (they all are public, and
created with the keyword 'var'). Consult the manual for changes between
PHP 4 & PHP 5:
http://nl2.php.net/manual/en/language.oop.php
http://nl2.php.net/manual/en/language.oop5.php

PHP 5 is pretty old now, and stable, so seriously consider upgrading if
you want to do anything with OOP.
--
Rik Wasmus
allain
Guest
 
Posts: n/a
#3: Dec 9 '07

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


On Dec 7, 7:57 pm, adam.timberl...@gmail.com wrote:
Quote:
Me again! I am trying to create a currency converter function for my
eCommerce that still pet treats. I am a little short on money recently
and so cannot afford a programmer. Can somebody tell me why my script
tells me that I have a syntax error on the "CONST" line. I am trying
to follow the article below.
>
Article:http://www.talkphp.com/showthread.php?t=1503
>
The error I get is:
>
Parse error: parse error, expecting `T_OLD_FUNCTION' or
`T_FUNCTION'...
>
My server is CentOS 4 or 5, I forget which, running PHP 4.1.0 with
MySQL 5, I think. The line that it shows me the error on is:
>
const OPT_FILE = 'talkphp_conversion_rates.json';
>
Please help! Also, somebody mentioned something about cross-posting on
newsgroups so that I can post to more than 1 group in case I do not
get a good answer in 1. Could somebody tell me how to do this with
Google Groups please!!
>
Thannk you.
If upgrading is not an option, you can use define to achieve a similar
thing.
define("OPT_FILE", 'talkphp_conversion_rates.json');
Jerry Stuckle
Guest
 
Posts: n/a
#4: Dec 10 '07

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


allain wrote:
Quote:
On Dec 7, 7:57 pm, adam.timberl...@gmail.com wrote:
Quote:
>Me again! I am trying to create a currency converter function for my
>eCommerce that still pet treats. I am a little short on money recently
>and so cannot afford a programmer. Can somebody tell me why my script
>tells me that I have a syntax error on the "CONST" line. I am trying
>to follow the article below.
>>
>Article:http://www.talkphp.com/showthread.php?t=1503
>>
>The error I get is:
>>
>Parse error: parse error, expecting `T_OLD_FUNCTION' or
>`T_FUNCTION'...
>>
>My server is CentOS 4 or 5, I forget which, running PHP 4.1.0 with
>MySQL 5, I think. The line that it shows me the error on is:
>>
>const OPT_FILE = 'talkphp_conversion_rates.json';
>>
>Please help! Also, somebody mentioned something about cross-posting on
>newsgroups so that I can post to more than 1 group in case I do not
>get a good answer in 1. Could somebody tell me how to do this with
>Google Groups please!!
>>
>Thannk you.
>
If upgrading is not an option, you can use define to achieve a similar
thing.
define("OPT_FILE", 'talkphp_conversion_rates.json');
>
In this case, upgrading is NOT an option, since PHP4 will go EOL in
about 3 weeks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Jerry Stuckle
Guest
 
Posts: n/a
#5: Dec 10 '07

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


Jerry Stuckle wrote:
Quote:
allain wrote:
Quote:
>On Dec 7, 7:57 pm, adam.timberl...@gmail.com wrote:
Quote:
>>Me again! I am trying to create a currency converter function for my
>>eCommerce that still pet treats. I am a little short on money recently
>>and so cannot afford a programmer. Can somebody tell me why my script
>>tells me that I have a syntax error on the "CONST" line. I am trying
>>to follow the article below.
>>>
>>Article:http://www.talkphp.com/showthread.php?t=1503
>>>
>>The error I get is:
>>>
>>Parse error: parse error, expecting `T_OLD_FUNCTION' or
>>`T_FUNCTION'...
>>>
>>My server is CentOS 4 or 5, I forget which, running PHP 4.1.0 with
>>MySQL 5, I think. The line that it shows me the error on is:
>>>
>>const OPT_FILE = 'talkphp_conversion_rates.json';
>>>
>>Please help! Also, somebody mentioned something about cross-posting on
>>newsgroups so that I can post to more than 1 group in case I do not
>>get a good answer in 1. Could somebody tell me how to do this with
>>Google Groups please!!
>>>
>>Thannk you.
>>
>If upgrading is not an option, you can use define to achieve a similar
>thing.
>define("OPT_FILE", 'talkphp_conversion_rates.json');
>>
>
In this case, upgrading is NOT an option, since PHP4 will go EOL in
about 3 weeks.
>
I mean, NOT upgrading is NOT an option...

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Closed Thread