3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( 'fromWeightkg', 'toWeightkg', 'value', 1, 0, '1', '0', ); foreach ($array as $value) { var_dump(gr($value)); } function gr($str) { $str[0] = strtoupper($str[0]); return $str; }
based on WEWcH
Output for 4.3.0 - 7.1.0
string(12) "FromWeightkg" string(10) "ToWeightkg" string(5) "Value" Warning: Cannot use a scalar value as an array in /in/QiZhG on line 17 int(1) Warning: Cannot use a scalar value as an array in /in/QiZhG on line 17 int(0) string(1) "1" string(1) "0"