3v4l.org

run code in 300+ PHP versions simultaneously
<?php $categories = array("MainCategory" => array(0,0,0), 'SubCategory' => array(1,7,7,7,7,1), 'Keyword' => array()); $mainArray = $categories['MainCategory']; $subArray = $categories['SubCategory']; $keyArray = $categories['Keyword']; if (count($mainArray) === 0) { $mainArray = array(""); } if (count($subArray) === 0) { $subArray = array(""); } if (count($keyArray) === 0) { $keyArray = array('lastname', 'email', 'phone'); } foreach ($subArray as $subcat) { foreach ($mainArray as $cat) { foreach ($keyArray as $keys) { echo $cat; echo $subcat; echo implode(',',$keys); } } }
Output for git.master, git.master_jit, rfc.property-hooks
01 Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /in/qJJTN:21 Stack trace: #0 /in/qJJTN(21): implode(',', 'lastname') #1 {main} thrown in /in/qJJTN on line 21
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:
47.99 ms | 401 KiB | 8 Q