Reputation: 2327
Can anyone explain...
Why this code's result is 18
<?php echo 3+"15%"+"$25"; ?>
Thanks
Upvotes: 0
Views: 67
Reputation: 5195
Because of the way that php parses strings to numbers. "15%" is 15 and "$25" is 0. You can check the specifics in the php manual: http://php.net/manual/en/language.types.string.php#language.types.string.conversion
Upvotes: 2