3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 元データを用意する $a[2]=10; $a[10]=2; $a[3]=30; $a[22]=20; $a[9]=4; $a[53]=29; //確認 echo ($a); //キーを保持してソート asort($a); //確認 print_r($a); //最初から 3 個を $b[] に代入 $i = 0; $b = array(); foreach ($a as $k=>$d){ $b[] = $k; if (3 <= ++$i){ break;} } //確認 print_r($b); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Array to string conversion in /in/11pqS on line 10 ArrayArray ( [10] => 2 [9] => 4 [2] => 10 [22] => 20 [53] => 29 [3] => 30 ) Array ( [0] => 10 [1] => 9 [2] => 2 )

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:
48.47 ms | 401 KiB | 8 Q