[thelist] PHP - Simple one

CDitty mail at redhotsweeps.com
Fri Oct 12 22:35:32 CDT 2001


Didn't work.  I'm running 4.0.4 pl1.

I didn't think I was that tired myself.

At 10:29 PM 10/12/2001, you wrote:
>At 08:18 PM 10/12/2001, you wrote:
>>Must be tired.  I can't seem to get this one to work right.   Should be 
>>really simple.  If there is a match, I need it to give 5 
>>points.  However, it is concatenating the variables together instead of 
>>adding it.  Any tips?
>>
>>Chris
>>
>>$points = 0;
>>
>>if($correct[0] == '1'){ // We have a match
>>      $points = $points + 5;
>>}
>>
>>echo $points;
>>
>>Should return something like 10 or 20.  Instead it returns 510152025.
>
>That makes no sense, and I'm not tired. ;-)
>
>What version of PHP are you using?
>
>http://www.php.net/manual/en/language.types.type-juggling.php
>
>says that it should work the way you are expecting. You might want to 
>force $points to be an Integer, with $points = intval($points) = 5;
>
>Good Luck.





More information about the thelist mailing list