3v4l.org

run code in 300+ PHP versions simultaneously
<?php $weight = array('Galeria', 'Rss', 'Grande', 'Mediana'); $options = array('Mediana', 'Galeria'); // de las opciones disponibles obtener la de mayor peso $option = ''; array_reduce($options, function(&$option, $item) use ($weight) { return $item > $option; }); var_dump($option); die; $tamano = 'Rss'; echo $attachmentSizes[$tamano]; die; $fotos = array(array('idAdjunto' => 1, 'tamano' => 'Grande'), array('idAdjunto' => 2, 'tamano'=>'Galeria'), array('idAdjunto' => 3, 'tamano'=>'Mediana')); $foto = array_filter($fotos, function($foto) use ($attachmentSizes) { return in_array($foto['tamano'], $attachmentSizes); }); $foto = array_shift($foto); var_dump($foto);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: {closure}(): Argument #1 ($option) must be passed by reference, value given in /in/d4DfT on line 8 Warning: {closure}(): Argument #1 ($option) must be passed by reference, value given in /in/d4DfT on line 8 string(0) ""

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