Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i got this line of code

$a=5;
$b="77ff";
$c=$a+$b;
echo $c;

it prints an error message once i run the code but still it adds the value of the 'a' to the number appears at the beginning of variable 'b' and then it prints 'c'

What I have tried:

ran the code with different string values checked that it only adds string to a number only if the string started with a numeric value is there a specific reason for that to happen or is it just how the php works?
Posted
Updated 21-Oct-21 8:28am

1 solution

 
Share this answer
 
Comments
SilentH11 21-Oct-21 14:41pm    
thanks it was helpful 🤗🤗
Maciej Los 21-Oct-21 17:25pm    
You're very welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900