I am trying to understand numeric strings in PHP. I have the following code:
var_dump(5 * "10 abc");
var_dump(is_numeric("10 abc"));
Which gives me the output:
int(50)
bool(false)
This confuses me as the string "10 abc" seems to be interpreted as a numeric string in the first expression (hence the int(50) output and no warnings about using a non-numeric value), but when run through the is_numeric() function it returns false, suggesting that it is in fact not a numeric string.
I have spent some time looking through the documentation to understand this behaviour but can't find any concrete answers, can somebody please help to explain what is causing this behaviour?
I am aware PHP 8.0.0 made some changes to what is considered a numeric string, but this is PHP 7.1.33 I am trying to understand right now.