3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Declare the suits $suits = array ( "Spades", "Hearts", "Clubs", "Diamonds" ); // Declare the faces $faces = array ( "Two"=>2, "Three"=>3, "Four"=>4, "Five"=>5, "Six"=>6, "Seven"=>7, "Eight"=>8, "Nine"=>9, "Ten"=>10, "Jack"=>10, "Queen"=>10, "King"=>10, "Ace"=>11 ); // create deck array // get all suits which has foreach($suits as $suit) { // get all the keys frok faces // now $keys = array_key($faces); // loop through the keys as faces foreach ($keys as $face) { // declare the deck array $deck = ['face' => $face, 'suit' => $suit]; var_dump($deck); } foreach($faces as $face => $value) { $deck = ['face' => $face, 'suit' => $suit ]; } var_dump($deck); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function array_key() in /in/SmM55:25 Stack trace: #0 {main} thrown in /in/SmM55 on line 25
Process exited with code 255.

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