$a = '88';
$b = '88 8888';
echo (int)$a;
echo (int)$b;
as expected, both produce 88. Anyone know if there’s a string to int function that will work for $b’s value and produce 888888? I’ve googled around a bit with no luck.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can remove the spaces before casting to
int:Also, if you want to strip other commonly used digit delimiters (such as
,), you can give the function an array (beware though — in some countries, like mine for example, the comma is used for fraction notation):