Page 1 of 1

Auto incrementation question

Posted: Tue Jul 08, 2003 10:42 am
by fd ski
Relative newbie here... asp / perl background.. loving php now. It's so... elegant !!

Anyway... question as follows. Simple webpage here is the erroring script

$somearray["somevalue"]++;

Error stats that value is undefined ( cause it doesn't exists first time its hit ) but increments it fine as if it was zero from the get go.
So it does what i need, but i could skip error message in my HTML :)

Sorry if this is a dumb newb question... i'm still learning.

Thanks.

fd

Posted: Tue Jul 08, 2003 10:57 am
by Wayne
it just looks like your error handling is rather high

this is a temporary fix,
try

Code: Select all

@$somearrayї"somevalue"]++;

or you could change the level of error handling

Posted: Tue Jul 08, 2003 11:17 am
by fd ski
that worked, thank you Wayne.

What does @$Value does ? I'm trying to find more info on @ but not much :( Something about documentation and treating everything that follows as a value, so basically it forces $value to have a value before it's incremented ?

Once again, thanks a bunch,
'

Posted: Tue Jul 08, 2003 12:12 pm
by discobean
you'll find the @ symbol when stuck infront of a function or expression dosn't return any errors or warnings..