3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class NumericComparisonFilter { private $reference; function __construct($reference) { $this->reference = $reference; } function isLower($num) { return $num < $this->reference; } function isGreater($num) { return $num > $this->reference; } function isEqual($num) { return $num == $this->reference; } } $arr = array(7, 8, 9, 10, 11, 12, 13); $persons = array( array( 'ID' => '3915' ,'Name' => 'Ахметзянов Ислам Галиахметович' ,'Post' => 'генеральный директор Филиала ОАО "ТАТМЕДИА" "ПИК "Идель-Пресс"' ,'Email' => 'id-press@yandex.ru' ,'Phone' => '8435432773' ,'Fax' => '' ,'Division' => 'дирекция' ,'Role' => '7' ) ,array( 'ID' => '3916' ,'Name' => 'Манжелеева Лариса Владимировна' ,'Post' => 'менеджер отдела маркетинга' ,'Email' => 'id-press@yandex.ru' ,'Phone' => '8435432773' ,'Fax' => '' ,'Division' => 'отдел маркетинга' ,'Role' => '0' ) ,array( 'ID' => '3918' ,'Name' => 'Хакимова Гульчачак Муллануровна' ,'Post' => 'менеджер отдела маркетинга' ,'Email' => 'id-press@yandex.ru' ,'Phone' => '8435432773' ,'Fax' => '' ,'Division' => 'отдел маркетинга' ,'Role' => '0' ) ,array( 'ID' => '5895' ,'Name' => 'Сафина Дания Робертовна' ,'Post' => 'менеджер' ,'Email' => 'id-press@yandex.ru' ,'Phone' => '' ,'Fax' => '' ,'Division' => 'отдел маркетинга' ,'Role' => '0' ) ,array( 'ID' => '22728' ,'Name' => 'Хасанов Ришат Рифгатович' ,'Post' => 'генеральный директор филиала ОАО "ТАТМЕДИА" "ПИК "Идель-Пресс"' ,'Email' => 'id-press@yandex.ru' ,'Phone' => '' ,'Fax' => '' ,'Division' => 'Филиал ОАО "ТАТМЕДИА" "ПИК "Идель-Пресс"' ,'Role' => '7' ) ); $matches = array_filter($arr, array(new NumericComparisonFilter(10), 'isLower')); print_r($matches); $matches = array_filter($arr, array(new NumericComparisonFilter(10), 'isGreater')); print_r($matches); $matches = array_filter($arr, array(new NumericComparisonFilter(10), 'isEqual')); print_r($matches); print_r($persons);
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 7 [1] => 8 [2] => 9 ) Array ( [4] => 11 [5] => 12 [6] => 13 ) Array ( [3] => 10 ) Array ( [0] => Array ( [ID] => 3915 [Name] => Ахметзянов Ислам Галиахметович [Post] => генеральный директор Филиала ОАО "ТАТМЕДИА" "ПИК "Идель-Пресс" [Email] => id-press@yandex.ru [Phone] => 8435432773 [Fax] => [Division] => дирекция [Role] => 7 ) [1] => Array ( [ID] => 3916 [Name] => Манжелеева Лариса Владимировна [Post] => менеджер отдела маркетинга [Email] => id-press@yandex.ru [Phone] => 8435432773 [Fax] => [Division] => отдел маркетинга [Role] => 0 ) [2] => Array ( [ID] => 3918 [Name] => Хакимова Гульчачак Муллануровна [Post] => менеджер отдела маркетинга [Email] => id-press@yandex.ru [Phone] => 8435432773 [Fax] => [Division] => отдел маркетинга [Role] => 0 ) [3] => Array ( [ID] => 5895 [Name] => Сафина Дания Робертовна [Post] => менеджер [Email] => id-press@yandex.ru [Phone] => [Fax] => [Division] => отдел маркетинга [Role] => 0 ) [4] => Array ( [ID] => 22728 [Name] => Хасанов Ришат Рифгатович [Post] => генеральный директор филиала ОАО "ТАТМЕДИА" "ПИК "Идель-Пресс" [Email] => id-press@yandex.ru [Phone] => [Fax] => [Division] => Филиал ОАО "ТАТМЕДИА" "ПИК "Идель-Пресс" [Role] => 7 ) )
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/11WZU on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/11WZU on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/11WZU on line 4
Process exited with code 255.