3v4l.org

run code in 300+ PHP versions simultaneously
<?php $IVR = array( "TagName:IVRCode" => array( "ExecApp:IVRCode" => array( "value" => "123456789" ), ), "TagName:SetLangSP" => array( "ExecApp:SetLang" => array( "value" => "ES" ), ), "TagName:Answer" => array( "ExecApp:Answer" => array( "value" => "" ), ), "TagName:PlayGreeting" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Greeting.${lang}", "AudioType" => "wav" ), ), "TagName:Menu1" => array( "ExecApp:PressMenu" => array( "MaxDigits" => "5", "TimeOut" => "3500", "AudioSource" => "AudioWav", "Type" => "Wav", "Invalid_Option" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Please-Type-A-Valid-Option.${lang}", "AudioType" => "wav" ), "ExecApp:GoTo" => array( "Value" => "Menu1" ), ), "TimeOut_Option" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Please-Type-A-Valid-Option.${lang}", "AudioType" => "wav" ), "ExecApp:GoTo" => array( "Value" => "Menu1" ), ), "Tree_Options" => array( "0:Operadora" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Wait-While-We-Transfer.${lang}", "AudioType" => "wav" ), "ExecApp:Transfer" => array( "Value" => "13626" ), ), "1:Ventas" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Wait-While-We-Transfer.${lang}", "AudioType" => "wav" ), "ExecApp:Transfer" => array( "Value" => "13626" ), ), "2:Servicio al cliente" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Wait-While-We-Transfer.${lang}", "AudioType" => "wav" ), "ExecApp:Transfer" => array( "Value" => "13626" ), ), "3:Soporte Tecnico" => array( "ExecApp:PressMenu" => array( "MaxDigits" => "5", "TimeOut" => "3500", "AudioSource" => "AudioWav", "Type" => "Wav", "Tree_Options" => array( "0:Television" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Wait-While-We-Transfer.${lang}", "AudioType" => "wav" ), "ExecApp:Transfer" => array( "Value" => "13626" ), ), "1:Internet" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Wait-While-We-Transfer.${lang}", "AudioType" => "wav" ), "ExecApp:Transfer" => array( "Value" => "13626" ), ), "2:Telefonia" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Wait-While-We-Transfer.${lang}", "AudioType" => "wav" ), "ExecApp:Transfer" => array( "Value" => "13626" ), ), "9:Previous Menu" => array( "ExecApp:Play" => array( "AudioValue" => "Audio-Wait-While-We-Transfer.${lang}", "AudioType" => "wav" ), "ExecApp:GoTo" => array( "Value" => "Menu1" ), ), ), ), ), ), ), ), ); echo '<pre>' . print_r($IVR,1) . '</pre>'; echo '<pre>' . print_r(goToTag($IVR, "2:Telefonia"),1) . '</pre>'; echo printAll($IVR); function printAll($a) { if (!is_array($a)) { echo $a, ' '; return; } foreach($a as $v) { printAll($v); } } function goToTag($array, $index) { $queue = array($array); while (($item = array_shift($queue)) !== null) { if (!is_array($item)) continue; if (isset($item[$index])) return $item[$index]; $queue = array_merge($queue, $item); } return null; } echo "-****-<br>"; $iterator = new RecursiveArrayIterator($IVR); iterator_apply($iterator, 'navigateArray', array($iterator)); function navigateArray($iterator) { while ($iterator->valid()) { if ($iterator->hasChildren()) { navigateArray($iterator->getChildren()); } else { printf("%s: %s ", $iterator->key(), $iterator->current()); } $iterator->next(); } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 20 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 32 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 41 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 51 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 60 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 69 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 85 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 94 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 103 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /in/TpF9u on line 112 Warning: Undefined variable $lang in /in/TpF9u on line 20 Warning: Undefined variable $lang in /in/TpF9u on line 32 Warning: Undefined variable $lang in /in/TpF9u on line 41 Warning: Undefined variable $lang in /in/TpF9u on line 51 Warning: Undefined variable $lang in /in/TpF9u on line 60 Warning: Undefined variable $lang in /in/TpF9u on line 69 Warning: Undefined variable $lang in /in/TpF9u on line 85 Warning: Undefined variable $lang in /in/TpF9u on line 94 Warning: Undefined variable $lang in /in/TpF9u on line 103 Warning: Undefined variable $lang in /in/TpF9u on line 112 <pre>Array ( [TagName:IVRCode] => Array ( [ExecApp:IVRCode] => Array ( [value] => 123456789 ) ) [TagName:SetLangSP] => Array ( [ExecApp:SetLang] => Array ( [value] => ES ) ) [TagName:Answer] => Array ( [ExecApp:Answer] => Array ( [value] => ) ) [TagName:PlayGreeting] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Greeting. [AudioType] => wav ) ) [TagName:Menu1] => Array ( [ExecApp:PressMenu] => Array ( [MaxDigits] => 5 [TimeOut] => 3500 [AudioSource] => AudioWav [Type] => Wav [Invalid_Option] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Please-Type-A-Valid-Option. [AudioType] => wav ) [ExecApp:GoTo] => Array ( [Value] => Menu1 ) ) [TimeOut_Option] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Please-Type-A-Valid-Option. [AudioType] => wav ) [ExecApp:GoTo] => Array ( [Value] => Menu1 ) ) [Tree_Options] => Array ( [0:Operadora] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Wait-While-We-Transfer. [AudioType] => wav ) [ExecApp:Transfer] => Array ( [Value] => 13626 ) ) [1:Ventas] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Wait-While-We-Transfer. [AudioType] => wav ) [ExecApp:Transfer] => Array ( [Value] => 13626 ) ) [2:Servicio al cliente] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Wait-While-We-Transfer. [AudioType] => wav ) [ExecApp:Transfer] => Array ( [Value] => 13626 ) ) [3:Soporte Tecnico] => Array ( [ExecApp:PressMenu] => Array ( [MaxDigits] => 5 [TimeOut] => 3500 [AudioSource] => AudioWav [Type] => Wav [Tree_Options] => Array ( [0:Television] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Wait-While-We-Transfer. [AudioType] => wav ) [ExecApp:Transfer] => Array ( [Value] => 13626 ) ) [1:Internet] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Wait-While-We-Transfer. [AudioType] => wav ) [ExecApp:Transfer] => Array ( [Value] => 13626 ) ) [2:Telefonia] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Wait-While-We-Transfer. [AudioType] => wav ) [ExecApp:Transfer] => Array ( [Value] => 13626 ) ) [9:Previous Menu] => Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Wait-While-We-Transfer. [AudioType] => wav ) [ExecApp:GoTo] => Array ( [Value] => Menu1 ) ) ) ) ) ) ) ) ) </pre><pre>Array ( [ExecApp:Play] => Array ( [AudioValue] => Audio-Wait-While-We-Transfer. [AudioType] => wav ) [ExecApp:Transfer] => Array ( [Value] => 13626 ) ) </pre>123456789 ES Audio-Greeting. wav 5 3500 AudioWav Wav Audio-Please-Type-A-Valid-Option. wav Menu1 Audio-Please-Type-A-Valid-Option. wav Menu1 Audio-Wait-While-We-Transfer. wav 13626 Audio-Wait-While-We-Transfer. wav 13626 Audio-Wait-While-We-Transfer. wav 13626 5 3500 AudioWav Wav Audio-Wait-While-We-Transfer. wav 13626 Audio-Wait-While-We-Transfer. wav 13626 Audio-Wait-While-We-Transfer. wav 13626 Audio-Wait-While-We-Transfer. wav Menu1 -****-<br>value: 123456789 value: ES value: AudioValue: Audio-Greeting. AudioType: wav MaxDigits: 5 TimeOut: 3500 AudioSource: AudioWav Type: Wav AudioValue: Audio-Please-Type-A-Valid-Option. AudioType: wav Value: Menu1 AudioValue: Audio-Please-Type-A-Valid-Option. AudioType: wav Value: Menu1 AudioValue: Audio-Wait-While-We-Transfer. AudioType: wav Value: 13626 AudioValue: Audio-Wait-While-We-Transfer. AudioType: wav Value: 13626 AudioValue: Audio-Wait-While-We-Transfer. AudioType: wav Value: 13626 MaxDigits: 5 TimeOut: 3500 AudioSource: AudioWav Type: Wav AudioValue: Audio-Wait-While-We-Transfer. AudioType: wav Value: 13626 AudioValue: Audio-Wait-While-We-Transfer. AudioType: wav Value: 13626 AudioValue: Audio-Wait-While-We-Transfer. AudioType: wav Value: 13626 AudioValue: Audio-Wait-While-We-Transfer. AudioType: wav Value: Menu1

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:
43.28 ms | 425 KiB | 8 Q