3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $_POST = array('foo'=>"on", 'hop'=>"on", 'bar'=>5); $protected = $_POST; foreach($protected as $key=>$value) { if($value=="on") { $protected[$key]="1"; } } var_dump($protected);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(3) { ["foo"]=> string(1) "1" ["hop"]=> string(1) "1" ["bar"]=> int(5) }