what am I missing?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jonathant
Forum Commoner
Posts: 32
Joined: Sat Jan 07, 2006 3:13 pm

what am I missing?

Post by jonathant »

Am I missing something? I'm new to php, and I am trying to make the jump from php4 to 5.

"Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /path_to_file/auctions.php5 on line 5"

Code: Select all

<?php
class Auction 
{
	// error checking
	public $err_no;
	public $err;

... rest of class
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

use var instead of public.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

no, php5 allows use of 'public $var;'

What is on the rest of the line?

As the error says you have an unexpected string, so you must have a stray string on that line, or missing a } / ) above it.

Please post entire class def :)
jonathant
Forum Commoner
Posts: 32
Joined: Sat Jan 07, 2006 3:13 pm

Post by jonathant »

DOH! I was running the script on it's own and getting no errors. But when I did require(auctions.php5) I was getting the error. Finally, I realized that I was requiring it on a php4 file. duh!
Post Reply