3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "data" => "data", "id_1553539135251" => "<p>nsmn</p>", "about" => "about", "id_1553539141598" => "<p>uiu</p>", ]; $result = []; $temp = []; foreach ($array as $k => $v) { if (str_starts_with($k, 'id_')) { $result[$k] = ['content' => $v] + $temp; $temp = []; } else { $temp[$k] = $v; } } var_export($result); /* array:3 [▼ "id_1553539135251" => array:1 [▼ "content" => "<p>nsmn</p>" "data" => "data" ] "id_1553539141598" => array:1 [▼ "content" => "<p>uiu</p>" "about" => "about" ] ] */
Output for git.master_jit, git.master
array ( 'id_1553539135251' => array ( 'content' => '<p>nsmn</p>', 'data' => 'data', ), 'id_1553539141598' => array ( 'content' => '<p>uiu</p>', 'about' => 'about', ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.02 ms | 405 KiB | 5 Q