Jump to content

Code not working


tyra

Recommended Posts

What am i dong wrong here and is there any other solutions to solve this problem ?

 

<?php
$num = 256; 
function atotal($num){ 
$num = strval($num); 
while(strlen($num) < 2){ 
for($i = 0; $i < strlen($num); $i++){ 
$total = $num{$i}; 
} 
$num = $total; 
if(strlen(strval($total)) != 1){ 
$total = 0; 
} 
} 
return $total; 
} 
echo atotal($num);
?>

Link to comment
https://forums.phpfreaks.com/topic/156388-code-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.