Page 2 of 2

Posted: Thu Sep 21, 2006 3:47 pm
by RobertGonzalez
Undefined index notices come from not wrapping your array index in quotes. It is a common error made by newer developers. This:

Code: Select all

$array_val = $array[index];
should be:

Code: Select all

$array_val = $array['index'];

Posted: Thu Sep 21, 2006 4:07 pm
by Obadiah
it got rid of the "Use of undefined constant op" but the undefined index one is still there

Posted: Thu Sep 21, 2006 4:57 pm
by RobertGonzalez
That means you are referencing an array var that has not been set yet. Like if you did this:

Code: Select all

$myarray = array();

echo $myarray['yellow'];

Posted: Fri Sep 22, 2006 9:48 am
by Obadiah
if im understanding the error and what your saying correctly...the error is being given because "op" doesnt have an initial value but if i were to give it a value...what would its init be? how would i go about setting it....the tutorial is the first scrip i posted...it dosent include a initial value for the op array....and/or dosent have it set to anything...i just assumed it didnt need to be