3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dist = "1"; $mapno = "5"; $parcel = "3.1"; $subparcel = ""; $parid = ""; if(strlen($dist) == 1){ $dist = '0' . $dist; } $arr = explode('.',$parcel); if (count($arr) > 1) { $parcel = $arr[0]; $subparcel = $arr[1]; } if(strlen($subparcel) == 1){ $subparcel = '0' . $subparcel; } $spcs = " "; if (strlen($mapno) == 1) { $spc = " "; } if (strlen($mapno) == 2){ $spc = " "; } $parid = $dist . $spc . str_pad($mapno, 4, '0', STR_PAD_RIGHT) . str_pad($parcel, 4, '0', STR_PAD_RIGHT) . str_pad($subparcel, 6, '0', STR_PAD_RIGHT); echo $parid; ?>
based on JBe3j
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
01 50003000010000