3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //Test cases from user's Project $people = array("DHL Guest PayPal", "DHL Guest BT", "DHL Guest Bank", "DHL Ret PayPal", "DHL Ret BT", "DHL Ret Bank", "DHL Wh PayPal", "DHL Wh BT", "DHL Wh Bank", "ACS Guest PayPal", "ACS Guest BT", "ACS Guest Bank", "ELTA Wh PayPal", "ELTA Wh BT", "ELTA Wh Bank"); //15 $count_deps = 0; $which_must_be_deleted = array(); // Dep/cies from user's above Project $words = array( array('Guest', 'PayPal'), //$words[0]-------------------------------->| //array('DHL', 'Guest') //$words[1]---------------------------------->| // | // | ); // | // | $sum = array(); // | $sum_teliko = array(); // | for ($p=0; $p<sizeof($words); $p++) { // | // | unset($sum); // | $sum = array(); // | echo "$p index of array $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n"; // | for ($i=0; $i<sizeof($people); $i++) { // | // | $var = $people[$i]; // | // | $ch = implode("|",$words[$p]); // <====| I pass the index of each array from the $words[] echo $pattern = '['.$ch.']'; if(preg_match_all($pattern, $var,$matches) >=2) { echo 'Αυτό απορρίπτεται γιατί βρήκα και τα 2....'; $sum[] = $i; //κρατάω τη θέση που βρήκα τις εξαιρέσεις echo "\n"; $which_must_be_deleted[] = $i; $count++; }else { echo 'Περνάει...'; echo "\n"; } } echo "$p index of array $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ \n"; $sum_teliko[$p] = $sum; echo "\n"; } echo "Dep/ces που πρέπει να αφαιρέσω " .$count ; echo "\n"; print_R($sum_teliko); echo "\n"; sort($which_must_be_deleted); print_R(array_unique($which_must_be_deleted)); // διαγραφω τα dep/cies απο τον αρχικο πινακα με τα test cases foreach ($which_must_be_deleted as $example) { unset($people[$example]); } // εκτυπωνω τα τελικα test cases print_R($people); ?>
based on shYQC
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.21.3, 7.0.0 - 7.3.0rc3
0 index of array $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ [Guest|PayPal]Αυτό απορρίπτεται γιατί βρήκα και τα 2.... Notice: Undefined variable: count in /in/pbXWP on line 54 [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Αυτό απορρίπτεται γιατί βρήκα και τα 2.... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... 0 index of array $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Dep/ces που πρέπει να αφαιρέσω 2 Array ( [0] => Array ( [0] => 0 [1] => 9 ) ) Array ( [0] => 0 [1] => 9 ) Array ( [1] => DHL Guest BT [2] => DHL Guest Bank [3] => DHL Ret PayPal [4] => DHL Ret BT [5] => DHL Ret Bank [6] => DHL Wh PayPal [7] => DHL Wh BT [8] => DHL Wh Bank [10] => ACS Guest BT [11] => ACS Guest Bank [12] => ELTA Wh PayPal [13] => ELTA Wh BT [14] => ELTA Wh Bank )
Output for hhvm-3.22.0
0 index of array $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ [Guest|PayPal]Αυτό απορρίπτεται γιατί βρήκα και τα 2.... Notice: Undefined variable: count in /in/pbXWP on line -1 [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Αυτό απορρίπτεται γιατί βρήκα και τα 2.... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... [Guest|PayPal]Περνάει... 0 index of array $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Dep/ces που πρέπει να αφαιρέσω 2 Array ( [0] => Array ( [0] => 0 [1] => 9 ) ) Array ( [0] => 0 [1] => 9 ) Array ( [1] => DHL Guest BT [2] => DHL Guest Bank [3] => DHL Ret PayPal [4] => DHL Ret BT [5] => DHL Ret Bank [6] => DHL Wh PayPal [7] => DHL Wh BT [8] => DHL Wh Bank [10] => ACS Guest BT [11] => ACS Guest Bank [12] => ELTA Wh PayPal [13] => ELTA Wh BT [14] => ELTA Wh Bank )