PHP remove last zero from integer by substr -


in php values database integer, want remove last 0 20000000 integer, me below code doesnt work.

$payerd_amount = 20000000; $payerd_amount = substr((string)$payerd_amount,1,strlen((string)$payerd_amount) -1); 

how action? code seems correct after substring result:

000 

if want remove last zero, divide 10

   $payerd_amount = $payerd_amount / 10; 

this works, too:

   $payerd_amount = substr($payerd_amount, 0, -1); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -