0

Reverse a number without using in built function in php.

<?php function reverse($x) { $flag = 0; For($i=1;$i<=$x;$i++) { $new = $x%10; $flag = $flag*10+$new; $x = $x/10; } echo $flag; } Reverse(786); ?>

6th Nov 2017, 7:21 AM
vinod
1 Respuesta
+ 5
Thanks but do this in code playground please :)
6th Nov 2017, 8:53 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar