3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dword = '00000000'; for ($i = 0; $i < 10; ++$i){ $dword = dword_inc($dword); echo $dword."\n"; } function dword_inc($dword){ if (empty($dword)){ return '1'; } $last = $dword{strlen($dword)-1}; if ($last == 9){ $last = 'A'; } $last++; if ($last == 'G'){ $last = 0; if (strlen($dword) > 1){ $dword2 = dword_inc(substr($dword, 0, strlen($dword)-1)); $dword = $dword2.'0'; }else{ $dword = '1'.$dword; } } return $dword; }
Output for 4.3.0 - 7.1.0
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000