Destramic Posted February 21, 2017 Share Posted February 21, 2017 (edited) hey guys im tyring to pass a integer to a method and i get this error: Invalid numeric literal when using this code $this->get_model('contract:contracts')->send_verification_pin(070000000000); i could use quotes like so $this->get_model('contract:contracts')->send_verification_pin('070000000000'); but then the integer has the 0 missing at the beginning...this is my debug int(7000000000) /^07\d{9}$/ ["Phone Number: Invalid phone number."] where is this missing 0 please guys? thank you Edited February 21, 2017 by Destramic Quote Link to comment Share on other sites More sharing options...
Solution kicken Posted February 22, 2017 Solution Share Posted February 22, 2017 Numbers that begin with a 0 are octal based numbers. I'd guess you get the error due to running a 32-bit version of PHP, in which case 070000000000 is larger than PHP can handle as an integer. On a related note, don't try and treat phone numbers as actual numbers, treat them a strings. Just because some value only consists of digits doesn't mean it needs to be treated as an integer type. 1 Quote Link to comment Share on other sites More sharing options...
Destramic Posted February 23, 2017 Author Share Posted February 23, 2017 Thank you for your help...changing the int to string work perfectly Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.