-1
I have a "Forgot Password" code. And at the time of generating the random number to send to email, is giving me this error:
Parse error: syntax error, Unexpected '(', expecting ',' or ';' on line 9
someone can help me with that?
//Criar um código aleátorio
var $min = 000001;
var $max = 100000;
var $codigo = rand($min,$max);
//fim criar código aleátorio
Post the error line and previous.
– rray
gave an up in the post!
– user50712
Well ... I suspect this is class definition, in php you would not assign a value that way would have to do this in the constructor. Obs:
var
was used in php4 ie if the code is not legacy do not use this, exchange for one of the access modifiers.– rray
@rray yes has a class just for the reason that I need to access the var $code again! Outside that would not need!
– user50712
Explaining what @rray said, you can’t call functions (like
rand
) in the definition of class properties, only in the constructor.– bfavaretto
@bfavaretto ah yes now it was clear, but how could I access this
rand
in another builder ?– user50712
I think that that answer solves or helps.
– rray