•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 392,048 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,339 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 136 | Replies: 5
![]() |
•
•
Join Date: Mar 2007
Location: GA
Posts: 27
Reputation:
Rep Power: 2
Solved Threads: 1
I am trying to understand why i am getting the following error:
PHP Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in C:\Registration.class.php on line 43
all of the variables being stored in the array are predefined.
PHP Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in C:\Registration.class.php on line 43
var $team1;
var $team2;
var $team3;
var $team4;
var $team5;
var $team6;
var $team7;
var $team8;
var $team9;
var $team10;
var $team11;
var $team12;
var $team13;
var $team14;
var $team15;
var $team16;
...
43: $teamMbrs= array($team1, $team2, $team3, $team4, $team5, $team6, $team7, $team8, $team9, $team10, $team11, $team12, $team13, $team14, $team15, $team16);all of the variables being stored in the array are predefined.
I believe you have to do something like:
php Syntax (Toggle Plain Text)
$teamMbrs= array(1 =>$team1, $team2, $team3, $team4, $team5, $team6, $team7, $team8, $team9, $team10, $team11, $team12, $team13, $team14, $team15, $team16);
Lost time is never found again.
- Benjamin Franklin
- Benjamin Franklin
•
•
Join Date: Jun 2008
Location: Phoenix, AZ
Posts: 538
Reputation:
Rep Power: 2
Solved Threads: 50
•
•
Join Date: Mar 2007
Location: GA
Posts: 27
Reputation:
Rep Power: 2
Solved Threads: 1
it is a class. I using daogen, http://www.titaniclinux.net/daogen/, generated source. The variables are pre-existing but I added the array to the class.
•
•
Join Date: Jun 2008
Location: Phoenix, AZ
Posts: 538
Reputation:
Rep Power: 2
Solved Threads: 50
•
•
•
•
it is a class. I using daogen, http://www.titaniclinux.net/daogen/, generated source. The variables are pre-existing but I added the array to the class.
in that case you need a "var" in front of your array to declare it and you cannot declare variables with non-constant values without a constructor, also this process(declare variables with non-constant values) must be in a function.
Last edited by R0bb0b : 29 Days Ago at 9:45 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
•
•
Join Date: Jun 2008
Location: Phoenix, AZ
Posts: 538
Reputation:
Rep Power: 2
Solved Threads: 50
so what you do is declare the array
then create a function, maybe like this
the call that function from the constructor like this
php Syntax (Toggle Plain Text)
var $teamMbrs= array();
then create a function, maybe like this
php Syntax (Toggle Plain Text)
function assignTeamMbrs() { $this->teamMbrs[] = $team1; $this->teamMbrs[] = $team2; $this->teamMbrs[] = $team3; $this->teamMbrs[] = $team4; $this->teamMbrs[] = $team5; $this->teamMbrs[] = $team6; $this->teamMbrs[] = $team7; $this->teamMbrs[] = $team8; $this->teamMbrs[] = $team9; $this->teamMbrs[] = $team10; $this->teamMbrs[] = $team11; $this->teamMbrs[] = $team12; $this->teamMbrs[] = $team13; $this->teamMbrs[] = $team14; $this->teamMbrs[] = $team15; $this->teamMbrs[] = $team16; }
the call that function from the constructor like this
php Syntax (Toggle Plain Text)
$this->assignTeamMbrs();
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- help with creating arrays (Pascal and Delphi)
- Creating login screens in VB6 (Visual Basic 4 / 5 / 6)
- Creating dynamic array structures (C++)
- Passing arrays of objects to functions (C++)
- passing arrays to classes? (Java)
- java problem with creating arrays (Java)
- creating random immutable numbers (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: setting default value to DropDown Menu using PHP
- Next Thread: utf-8 in php


Linear Mode