Gyandeep Sharma
Gyandeep Sharma

Reputation: 2327

Please Explain Why this code's result is 18

Can anyone explain...

Why this code's result is 18

<?php echo 3+"15%"+"$25";  ?>

Thanks

Upvotes: 0

Views: 67

Answers (1)

blues
blues

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

Related Questions