3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function sort_link_param ( $link ) { $option = explode('?',$link); if($option[1]){ $arr = explode('&',$option[1]); sort($arr); $link = $option[0].'?'; foreach($arr as $value){ $link.= $value.'&'; } return trim($link,'&'); } else{ return $link; } } $split_stat = array ( 0 => array ( 'land' => '/sign/wall?fr=1', 'visits' => 4, 'regs' => 0, 'split_redirect' => 4, 'weight' => 14, ), 1 => array ( 'land' => '/sign/wall?mm=1', 'visits' => 5, 'regs' => 0, 'split_redirect' => 5, 'weight' => 14, ), 2 => array ( 'land' => '/sign/inter?fb=1&fr=1&mm=1&vk=1', 'visits' => 7, 'regs' => 0, 'split_redirect' => 7, 'weight' => 14, ), 3 => array ( 'land' => '/sign/anim', 'visits' => 4, 'regs' => 0, 'split_redirect' => 4, 'weight' => 14, ), 4 => array ( 'land' => '/sign/blue', 'visits' => 1, 'regs' => 0, 'split_redirect' => 1, 'weight' => 14, ), 5 => array ( 'land' => '/sign/select', 'visits' => 5, 'regs' => 0, 'split_redirect' => 5, 'weight' => 14, ), 6 => array ( 'land' => '/sign/inter?mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 14, ), 7 => array ( 'land' => '/sign/inter?fb=1&fr=1&mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 8 => array ( 'land' => '/sign/inter?mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 9 => array ( 'land' => '/sign/inter?fb=1&fr=1&mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 10 => array ( 'land' => '/sign/inter?mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 11 => array ( 'land' => '/sign/inter?fb=1&fr=1&mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 12 => array ( 'land' => '/sign/inter?mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 13 => array ( 'land' => '/sign/inter?fb=1&fr=1&mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 14 => array ( 'land' => '/sign/inter?mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 15 => array ( 'land' => '/sign/inter?fb=1&fr=1&mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 16 => array ( 'land' => '/sign/inter?mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 17 => array ( 'land' => '/sign/inter?fb=1&fr=1&mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), 18 => array ( 'land' => '/sign/inter?mm=1&vk=1', 'visits' => 0, 'regs' => 0, 'split_redirect' => 0, 'weight' => 100, ), ); $split_lands = array ( 0 => '/sign/wall?fr=1', 1 => '/sign/wall?mm=1', 2 => '/sign/inter?fr=1&fb=1&vk=1&mm=1', 3 => '/sign/anim', 4 => '/sign/blue', 5 => '/sign/select', 6 => '/sign/inter?vk=1&mm=1', ); foreach ( $split_stat as $stat ) $lands_in_stat[] = sort_link_param($stat['land']); var_dump($lands_in_stat); var_dump($split_lands); $lands_not_in_stat = array_diff($split_lands, $lands_in_stat); var_dump($lands_not_in_stat);
based on RVPdN
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: 1 in /in/oHQF5 on line 7 Notice: Undefined offset: 1 in /in/oHQF5 on line 7 Notice: Undefined offset: 1 in /in/oHQF5 on line 7 array(19) { [0]=> string(15) "/sign/wall?fr=1" [1]=> string(15) "/sign/wall?mm=1" [2]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [3]=> string(10) "/sign/anim" [4]=> string(10) "/sign/blue" [5]=> string(12) "/sign/select" [6]=> string(21) "/sign/inter?mm=1&vk=1" [7]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [8]=> string(21) "/sign/inter?mm=1&vk=1" [9]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [10]=> string(21) "/sign/inter?mm=1&vk=1" [11]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [12]=> string(21) "/sign/inter?mm=1&vk=1" [13]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [14]=> string(21) "/sign/inter?mm=1&vk=1" [15]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [16]=> string(21) "/sign/inter?mm=1&vk=1" [17]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [18]=> string(21) "/sign/inter?mm=1&vk=1" } array(7) { [0]=> string(15) "/sign/wall?fr=1" [1]=> string(15) "/sign/wall?mm=1" [2]=> string(31) "/sign/inter?fr=1&fb=1&vk=1&mm=1" [3]=> string(10) "/sign/anim" [4]=> string(10) "/sign/blue" [5]=> string(12) "/sign/select" [6]=> string(21) "/sign/inter?vk=1&mm=1" } array(2) { [2]=> string(31) "/sign/inter?fr=1&fb=1&vk=1&mm=1" [6]=> string(21) "/sign/inter?vk=1&mm=1" }
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: 1 in /in/oHQF5 on line 7 Notice: Undefined index: 1 in /in/oHQF5 on line 7 Notice: Undefined index: 1 in /in/oHQF5 on line 7 array(19) { [0]=> string(15) "/sign/wall?fr=1" [1]=> string(15) "/sign/wall?mm=1" [2]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [3]=> string(10) "/sign/anim" [4]=> string(10) "/sign/blue" [5]=> string(12) "/sign/select" [6]=> string(21) "/sign/inter?mm=1&vk=1" [7]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [8]=> string(21) "/sign/inter?mm=1&vk=1" [9]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [10]=> string(21) "/sign/inter?mm=1&vk=1" [11]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [12]=> string(21) "/sign/inter?mm=1&vk=1" [13]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [14]=> string(21) "/sign/inter?mm=1&vk=1" [15]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [16]=> string(21) "/sign/inter?mm=1&vk=1" [17]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [18]=> string(21) "/sign/inter?mm=1&vk=1" } array(7) { [0]=> string(15) "/sign/wall?fr=1" [1]=> string(15) "/sign/wall?mm=1" [2]=> string(31) "/sign/inter?fr=1&fb=1&vk=1&mm=1" [3]=> string(10) "/sign/anim" [4]=> string(10) "/sign/blue" [5]=> string(12) "/sign/select" [6]=> string(21) "/sign/inter?vk=1&mm=1" } array(2) { [2]=> string(31) "/sign/inter?fr=1&fb=1&vk=1&mm=1" [6]=> string(21) "/sign/inter?vk=1&mm=1" }
Output for 4.3.0 - 5.2.17
Notice: Undefined offset: 1 in /in/oHQF5 on line 7 Notice: Undefined offset: 1 in /in/oHQF5 on line 7 Notice: Undefined offset: 1 in /in/oHQF5 on line 7 array(19) { [0]=> string(15) "/sign/wall?fr=1" [1]=> string(15) "/sign/wall?mm=1" [2]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [3]=> string(10) "/sign/anim" [4]=> string(10) "/sign/blue" [5]=> string(12) "/sign/select" [6]=> string(21) "/sign/inter?mm=1&vk=1" [7]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [8]=> string(21) "/sign/inter?mm=1&vk=1" [9]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [10]=> string(21) "/sign/inter?mm=1&vk=1" [11]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [12]=> string(21) "/sign/inter?mm=1&vk=1" [13]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [14]=> string(21) "/sign/inter?mm=1&vk=1" [15]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [16]=> string(21) "/sign/inter?mm=1&vk=1" [17]=> string(31) "/sign/inter?fb=1&fr=1&mm=1&vk=1" [18]=> string(21) "/sign/inter?mm=1&vk=1" } array(7) { [0]=> string(15) "/sign/wall?fr=1" [1]=> string(15) "/sign/wall?mm=1" [2]=> string(31) "/sign/inter?fr=1&fb=1&vk=1&mm=1" [3]=> string(10) "/sign/anim" [4]=> string(10) "/sign/blue" [5]=> string(12) "/sign/select" [6]=> string(21) "/sign/inter?vk=1&mm=1" } array(2) { [2]=> string(31) "/sign/inter?fr=1&fb=1&vk=1&mm=1" [6]=> string(21) "/sign/inter?vk=1&mm=1" }