returning value to variable
am 14.02.2004 14:59:22 von tg
hi
i need returning value of function as a variable
example :
function 1 () {
return "some error";
}
function 2 () {
$v = 1();
if ( $v != '' ) echo "error";
}
it doesn't work this way
this works : echo 1();
but i need the string value as a variable
thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: returning value to variable
am 14.02.2004 17:50:32 von BAO RuiXian
tg wrote:
> hi
>
> i need returning value of function as a variable
>
> example :
>
> function 1 () {
> return "some error";
> }
>
> function 2 () {
> $v = 1();
> if ( $v != '' ) echo "error";
> }
>
> it doesn't work this way
Are you using 1 and 2 as the function names in your real application?
Hope not, because function names same as variable names in all languges
can not begine with digit. Your 1 and 2 functions not work in my
computer either, but they start to work after I have changed 1 and 2 to
a and b respectively.
Best
Bao
> this works : echo 1();
> but i need the string value as a variable
>
> thanks
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: returning value to variable
am 14.02.2004 18:14:39 von tg
Bao Ruixian wrote:
>
>
> tg wrote:
>
>> hi
>>
>> i need returning value of function as a variable
>>
>> example :
>>
>> function 1 () {
>> return "some error";
>> }
>>
>> function 2 () {
>> $v = 1();
>> if ( $v != '' ) echo "error";
>> }
>>
>> it doesn't work this way
>
>
> Are you using 1 and 2 as the function names in your real application?
of course not, it was an example
btw. i has already solved the problem
it was a stupid fault, i returned the value of the function
but i didn't print it in the main code, so i thought
that something's wrong
TG
> Hope not, because function names same as variable names in all languges
> can not begine with digit. Your 1 and 2 functions not work in my
> computer either, but they start to work after I have changed 1 and 2 to
> a and b respectively.
>
> Best
>
> Bao
>
>> this works : echo 1();
>> but i need the string value as a variable
>>
>> thanks
>>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php