3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function check($s1, $s2) { global $jdeg, $lmon; //var_dump($s1, $s2); $deg1 = $jdeg[$s1]; $deg2 = $jdeg[$s2]; $mon1 = $lmon[$deg1]; $mon2 = $lmon[$deg2]; if( ($deg1 == 270 || $deg2 == 270) || ($deg1 == 0 || $deg2 == 0) || ($deg1 == 90 || $deg2 == 90) || ($deg1 == 180 || $deg2 == 180) ) { if($deg1 == 270 || $deg1 == 0 || $deg1 == 90 || $deg1 == 180) { $ldeg1 = $deg1; $ldeg2 = $deg2; $lmon1 = $mon1; $lmon2 = $mon2; } else { $ldeg1 = $deg2; $ldeg2 = $deg1; $lmon1 = $mon2; $lmon2 = $mon1; } } else { $ldeg1 = $deg1; $ldeg2 = $deg2; $lmon1 = $mon1; $lmon2 = $mon2; } return array($ldeg1, $ldeg2, $lmon1, $lmon2); } function main() { global $lmon, $jdeg, $jung; $lmon = array(330 => 1, 0 => 2, 30 => 3, 60 => 4, 90 => 5, 120 => 6, 150 => 7, 180 => 8, 210 => 9, 240 => 10, 270 => 11, 300 => 12); $jdeg = array( 0 => "270", 1 => "300", 2 => "330", 3 => "0", 4 => "30", 5 => "60", 6 => "90", 7 => "120", 8 => "150", 9 => "180", 10 => "210", 11 => "240", 12 => "270", 13 => "300", 14 => "330", 15 => "0", 16 => "30", 17 => "60", 18 => "90", 19 => "120", 20 => "150", 21 => "180", 22 => "210", 23 => "240", 24 => "270", 25 => "300", 26 => "330", 27 => "0", 28 => "30", 29 => "60", 30 => "90", 31 => "120", 32 => "150", 33 => "180", 34 => "210", 35 => "240", 36 => "270", 37 => "300", 38 => "330", 39 => "0", 40 => "30", 41 => "60", 42 => "90", 43 => "120", 44 => "150", 45 => "180", 46 => "210", 47 => "240", 48 => "270", 49 => "300", 50 => "330", 51 => "0", 52 => "30", 53 => "60", 54 => "90", 55 => "120", 56 => "150", 57 => "180", 58 => "210", 59 => "240", 60 => "270", 61 => "300", 62 => "330", 63 => "0", 64 => "30", 65 => "60", 66 => "90", 67 => "120", 68 => "150", 69 => "180", 70 => "210", 71 => "240", 72 => "270", 73 => "300", 74 => "330", 75 => "0", 76 => "30", 77 => "60", 78 => "90", 79 => "120", 80 => "150", 81 => "180", 82 => "210", 83 => "240", 84 => "270", 85 => "300", 86 => "330", 87 => "0", 88 => "30", 89 => "60", 90 => "90", 91 => "120", 92 => "150", 93 => "180", 94 => "210", 95 => "240", 96 => "270", 97 => "300", 98 => "330", 99 => "0", 100 => "30", 101 => "60", 102 => "90", 103 => "120", 104 => "150"); $jung = array( 0 => "0", 1 => "1", 2 => "2", 3 => "3", 4 => "4", 5 => "5", 6 => "6", 7 => "7", 8 => "8", 9 => "9", 10 => "10", 11 => "11", 12 => "12", 13 => "13", 14 => "14", 15 => "15", 16 => "16", 17 => "17", 18 => "18", 19 => "19", 20 => "20", 21 => "21", 22 => "22", 23 => "23", 24 => "24", 25 => "-1", 26 => "25", 27 => "26", 28 => "27", 29 => "28", 30 => "29", 31 => "30", 32 => "31", 33 => "32", 34 => "33", 35 => "34", 36 => "35", 37 => "36", 38 => "37", 39 => "38", 40 => "39", 41 => "40", 42 => "41", 43 => "42", 44 => "43", 45 => "44", 46 => "45", 47 => "46", 48 => "47", 49 => "48", 50 => "49", 51 => "50", 52 => "51", 53 => "52", 54 => "53", 55 => "-1", 56 => "54", 57 => "55.56", 58 => "-1", 59 => "57.58", 60 => "-1", 61 => "59", 62 => "60", 63 => "61", 64 => "62", 65 => "63", 66 => "64", 67 => "65", 68 => "66", 69 => "67", 70 => "68", 71 => "69", 72 => "70", 73 => "71", 74 => "72", 75 => "73", 76 => "74", 77 => "75", 78 => "76", 79 => "77", 80 => "78", 81 => "79", 82 => "80", 83 => "81", 84 => "82", 85 => "83", 86 => "84", 87 => "85", 88 => "86", 89 => "87", 90 => "-1", 91 => "88", 92 => "89", 93 => "90", 94 => "91", 95 => "92", 96 => "93", 97 => "94", 98 => "95", 99 => "96", 100 => "97"); test(); } function test() { global $lmon, $jdeg, $jung; for($j=0; $j<100; $j++) { for($i=0; $i<100; $i++) { $r = $jung[$i]; if(preg_match("/\./", $r)) { $s = preg_split("/\./", $r); $s0 = $s[0]; $s1 = $s[1]; //var_dump($s); $r = check($s0, $s1); echo "[$j][$i] : $r[0], $r[1], $r[2], $r[3]\n"; } } } } main();
based on srfgg
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
[0][57] : 120, 150, 6, 7 [0][59] : 180, 210, 8, 9 [1][57] : 120, 150, 6, 7 [1][59] : 180, 210, 8, 9 [2][57] : 120, 150, 6, 7 [2][59] : 180, 210, 8, 9 [3][57] : 120, 150, 6, 7 [3][59] : 180, 210, 8, 9 [4][57] : 120, 150, 6, 7 [4][59] : 180, 210, 8, 9 [5][57] : 120, 150, 6, 7 [5][59] : 180, 210, 8, 9 [6][57] : 120, 150, 6, 7 [6][59] : 180, 210, 8, 9 [7][57] : 120, 150, 6, 7 [7][59] : 180, 210, 8, 9 [8][57] : 120, 150, 6, 7 [8][59] : 180, 210, 8, 9 [9][57] : 120, 150, 6, 7 [9][59] : 180, 210, 8, 9 [10][57] : 120, 150, 6, 7 [10][59] : 180, 210, 8, 9 [11][57] : 120, 150, 6, 7 [11][59] : 180, 210, 8, 9 [12][57] : 120, 150, 6, 7 [12][59] : 180, 210, 8, 9 [13][57] : 120, 150, 6, 7 [13][59] : 180, 210, 8, 9 [14][57] : 120, 150, 6, 7 [14][59] : 180, 210, 8, 9 [15][57] : 120, 150, 6, 7 [15][59] : 180, 210, 8, 9 [16][57] : 120, 150, 6, 7 [16][59] : 180, 210, 8, 9 [17][57] : 120, 150, 6, 7 [17][59] : 180, 210, 8, 9 [18][57] : 120, 150, 6, 7 [18][59] : 180, 210, 8, 9 [19][57] : 120, 150, 6, 7 [19][59] : 180, 210, 8, 9 [20][57] : 120, 150, 6, 7 [20][59] : 180, 210, 8, 9 [21][57] : 120, 150, 6, 7 [21][59] : 180, 210, 8, 9 [22][57] : 120, 150, 6, 7 [22][59] : 180, 210, 8, 9 [23][57] : 120, 150, 6, 7 [23][59] : 180, 210, 8, 9 [24][57] : 120, 150, 6, 7 [24][59] : 180, 210, 8, 9 [25][57] : 120, 150, 6, 7 [25][59] : 180, 210, 8, 9 [26][57] : 120, 150, 6, 7 [26][59] : 180, 210, 8, 9 [27][57] : 120, 150, 6, 7 [27][59] : 180, 210, 8, 9 [28][57] : 120, 150, 6, 7 [28][59] : 180, 210, 8, 9 [29][57] : 120, 150, 6, 7 [29][59] : 180, 210, 8, 9 [30][57] : 120, 150, 6, 7 [30][59] : 180, 210, 8, 9 [31][57] : 120, 150, 6, 7 [31][59] : 180, 210, 8, 9 [32][57] : 120, 150, 6, 7 [32][59] : 180, 210, 8, 9 [33][57] : 120, 150, 6, 7 [33][59] : 180, 210, 8, 9 [34][57] : 120, 150, 6, 7 [34][59] : 180, 210, 8, 9 [35][57] : 120, 150, 6, 7 [35][59] : 180, 210, 8, 9 [36][57] : 120, 150, 6, 7 [36][59] : 180, 210, 8, 9 [37][57] : 120, 150, 6, 7 [37][59] : 180, 210, 8, 9 [38][57] : 120, 150, 6, 7 [38][59] : 180, 210, 8, 9 [39][57] : 120, 150, 6, 7 [39][59] : 180, 210, 8, 9 [40][57] : 120, 150, 6, 7 [40][59] : 180, 210, 8, 9 [41][57] : 120, 150, 6, 7 [41][59] : 180, 210, 8, 9 [42][57] : 120, 150, 6, 7 [42][59] : 180, 210, 8, 9 [43][57] : 120, 150, 6, 7 [43][59] : 180, 210, 8, 9 [44][57] : 120, 150, 6, 7 [44][59] : 180, 210, 8, 9 [45][57] : 120, 150, 6, 7 [45][59] : 180, 210, 8, 9 [46][57] : 120, 150, 6, 7 [46][59] : 180, 210, 8, 9 [47][57] : 120, 150, 6, 7 [47][59] : 180, 210, 8, 9 [48][57] : 120, 150, 6, 7 [48][59] : 180, 210, 8, 9 [49][57] : 120, 150, 6, 7 [49][59] : 180, 210, 8, 9 [50][57] : 120, 150, 6, 7 [50][59] : 180, 210, 8, 9 [51][57] : 120, 150, 6, 7 [51][59] : 180, 210, 8, 9 [52][57] : 120, 150, 6, 7 [52][59] : 180, 210, 8, 9 [53][57] : 120, 150, 6, 7 [53][59] : 180, 210, 8, 9 [54][57] : 120, 150, 6, 7 [54][59] : 180, 210, 8, 9 [55][57] : 120, 150, 6, 7 [55][59] : 180, 210, 8, 9 [56][57] : 120, 150, 6, 7 [56][59] : 180, 210, 8, 9 [57][57] : 120, 150, 6, 7 [57][59] : 180, 210, 8, 9 [58][57] : 120, 150, 6, 7 [58][59] : 180, 210, 8, 9 [59][57] : 120, 150, 6, 7 [59][59] : 180, 210, 8, 9 [60][57] : 120, 150, 6, 7 [60][59] : 180, 210, 8, 9 [61][57] : 120, 150, 6, 7 [61][59] : 180, 210, 8, 9 [62][57] : 120, 150, 6, 7 [62][59] : 180, 210, 8, 9 [63][57] : 120, 150, 6, 7 [63][59] : 180, 210, 8, 9 [64][57] : 120, 150, 6, 7 [64][59] : 180, 210, 8, 9 [65][57] : 120, 150, 6, 7 [65][59] : 180, 210, 8, 9 [66][57] : 120, 150, 6, 7 [66][59] : 180, 210, 8, 9 [67][57] : 120, 150, 6, 7 [67][59] : 180, 210, 8, 9 [68][57] : 120, 150, 6, 7 [68][59] : 180, 210, 8, 9 [69][57] : 120, 150, 6, 7 [69][59] : 180, 210, 8, 9 [70][57] : 120, 150, 6, 7 [70][59] : 180, 210, 8, 9 [71][57] : 120, 150, 6, 7 [71][59] : 180, 210, 8, 9 [72][57] : 120, 150, 6, 7 [72][59] : 180, 210, 8, 9 [73][57] : 120, 150, 6, 7 [73][59] : 180, 210, 8, 9 [74][57] : 120, 150, 6, 7 [74][59] : 180, 210, 8, 9 [75][57] : 120, 150, 6, 7 [75][59] : 180, 210, 8, 9 [76][57] : 120, 150, 6, 7 [76][59] : 180, 210, 8, 9 [77][57] : 120, 150, 6, 7 [77][59] : 180, 210, 8, 9 [78][57] : 120, 150, 6, 7 [78][59] : 180, 210, 8, 9 [79][57] : 120, 150, 6, 7 [79][59] : 180, 210, 8, 9 [80][57] : 120, 150, 6, 7 [80][59] : 180, 210, 8, 9 [81][57] : 120, 150, 6, 7 [81][59] : 180, 210, 8, 9 [82][57] : 120, 150, 6, 7 [82][59] : 180, 210, 8, 9 [83][57] : 120, 150, 6, 7 [83][59] : 180, 210, 8, 9 [84][57] : 120, 150, 6, 7 [84][59] : 180, 210, 8, 9 [85][57] : 120, 150, 6, 7 [85][59] : 180, 210, 8, 9 [86][57] : 120, 150, 6, 7 [86][59] : 180, 210, 8, 9 [87][57] : 120, 150, 6, 7 [87][59] : 180, 210, 8, 9 [88][57] : 120, 150, 6, 7 [88][59] : 180, 210, 8, 9 [89][57] : 120, 150, 6, 7 [89][59] : 180, 210, 8, 9 [90][57] : 120, 150, 6, 7 [90][59] : 180, 210, 8, 9 [91][57] : 120, 150, 6, 7 [91][59] : 180, 210, 8, 9 [92][57] : 120, 150, 6, 7 [92][59] : 180, 210, 8, 9 [93][57] : 120, 150, 6, 7 [93][59] : 180, 210, 8, 9 [94][57] : 120, 150, 6, 7 [94][59] : 180, 210, 8, 9 [95][57] : 120, 150, 6, 7 [95][59] : 180, 210, 8, 9 [96][57] : 120, 150, 6, 7 [96][59] : 180, 210, 8, 9 [97][57] : 120, 150, 6, 7 [97][59] : 180, 210, 8, 9 [98][57] : 120, 150, 6, 7 [98][59] : 180, 210, 8, 9 [99][57] : 120, 150, 6, 7 [99][59] : 180, 210, 8, 9
Output for hhvm-3.10.0

Process exited with code 153.