3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "hello:20,test:40,abc:25"; function transform_input($input) { return array_map(function ($value) { list($title, $length) = explode(':', $value); return [ 'title' => $title, 'length' => $length ]; }, explode(',', $input)); } $array = transform_input($input); for($i=0; $i < count($array); $i++) { ?> <th><?=$array[$i]["length"]?></th> <th><?=$array[$i]["title"]?></th> <?php } ?>

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
158.16 ms | 2021 KiB | 13 Q