|
Posted by Janwillem Borleffs on 12/18/96 11:52
Jarrod wrote:
> $testing = '10';
> $end = end($array); // this would equal to 10
>
>
> if($testing == $end){
> print 'yes';
> }else{
> print 'no';
> }
>
This should work as long as $end contains the integer 10, or a string "10".
When it contains "10" followed by a space or another alphanumeric character,
it will fail, because $testing being defined as a string, $end will also be
considered as and converted to a string for the condition evaluation and
'10' isn't equal to '10 '.
The simplest workaround would be to ensure that $testing contains an integer
($testing = 10;), which causes $end to be considered in the condition as a
number.
JW
Navigation:
[Reply to this message]
|