3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = "device_id=LA14011269&card_number=1073741835&mpb=1000&trans_time=1429443693&sessionId=1073741835LA140112691429443693&checksum=4"; echo checkBcc($str,4); function checkBcc($str, $check_sum) { $i=0; $checksum = 0; $result = false; $len = strlen($str); echo " str:".$str; $pBuf = explode($str); print_r($pBuf); for ($i = 0; $i < $len-2; $i++) { $checksum ^= $pBuf[$i]; } echo "checksum:". $checksum; if ($checksum == $check_sum) { $result = true; } return $result; } ?>
based on lZqe7
Output for 5.3.0 - 7.2.0
str:device_id=LA14011269&card_number=1073741835&mpb=1000&trans_time=1429443693&sessionId=1073741835LA140112691429443693&checksum=4 Warning: explode() expects at least 2 parameters, 1 given in /in/TF53C on line 13 checksum:0
Output for 4.3.0 - 5.2.17
str:device_id=LA14011269&card_number=1073741835&mpb=1000&trans_time=1429443693&sessionId=1073741835LA140112691429443693&checksum=4 Warning: Wrong parameter count for explode() in /in/TF53C on line 13 checksum:0