3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "a:1:{i:0;i:1;}", "a:3:{i:0;i:2;i:1;i:2;i:2;i:3;}", "a:3:{i:0;i:3;i:1;i:2;i:2;i:3;}", ]; $row = [['temp' => 1], ['temp1' => 2], ['temp3' => 2]]; $temp = array_map('unserialize', $arr); $brand_id = 1; $result = false; foreach ($temp as $key => $value) { if (!empty($value) && in_array($brand_id, $value)) { $result[] = $row[$key]; } } print_r($result); $brand_id = 2; $result = false; foreach ($temp as $key => $value) { if (!empty($value) && in_array($brand_id, $value)) { $result[] = $row[$key]; } } print_r($result);
Output for git.master, git.master_jit
/bin/php-git-master: error while loading shared libraries: libonig.so.5: cannot open shared object file: No such file or directory
Process exited with code 127.
Output for rfc.property-hooks
Deprecated: Automatic conversion of false to array is deprecated in /in/e44aG on line 14 Array ( [0] => Array ( [temp] => 1 ) ) Deprecated: Automatic conversion of false to array is deprecated in /in/e44aG on line 23 Array ( [0] => Array ( [temp1] => 2 ) [1] => Array ( [temp3] => 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:
154.68 ms | 407 KiB | 5 Q