3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $my_array = array(); $my_array['id'] = 4127 ; $my_array['nick'] = 'Jonas'; $my_array['dte79855545'] = 5; foreach ($my_array as $key => $value) { if (substr ( $key , 0 , 3 )=='dte') { $the_dte_id = substr ( $key , 3); $the_dte_value = $value; } } echo "The dte id is:".$the_dte_id." and the value is ".$the_dte_value; ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
The dte id is:79855545 and the value is 5