3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = range(-2, 2); $b = range(-2, 2, 0.5); $opResults = []; $funcResults = []; foreach($a as $_a) { foreach($b as $_b) { $opResults[] = $_a ** $_b; $funcResults[] = pow($_a, $_b); } } var_dump($opResults === $funcResults, $opResults, $funcResults);
based on uklK9
Output for 5.6.8 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
bool(false) array(45) { [0]=> float(0.25) [1]=> float(NAN) [2]=> float(-0.5) [3]=> float(NAN) [4]=> float(1) [5]=> float(NAN) [6]=> float(-2) [7]=> float(NAN) [8]=> float(4) [9]=> float(1) [10]=> float(NAN) [11]=> float(-1) [12]=> float(NAN) [13]=> float(1) [14]=> float(NAN) [15]=> float(-1) [16]=> float(NAN) [17]=> float(1) [18]=> float(INF) [19]=> float(INF) [20]=> float(INF) [21]=> float(INF) [22]=> float(1) [23]=> float(0) [24]=> float(0) [25]=> float(0) [26]=> float(0) [27]=> float(1) [28]=> float(1) [29]=> float(1) [30]=> float(1) [31]=> float(1) [32]=> float(1) [33]=> float(1) [34]=> float(1) [35]=> float(1) [36]=> float(0.25) [37]=> float(0.35355339059327) [38]=> float(0.5) [39]=> float(0.70710678118655) [40]=> float(1) [41]=> float(1.4142135623731) [42]=> float(2) [43]=> float(2.8284271247462) [44]=> float(4) } array(45) { [0]=> float(0.25) [1]=> float(NAN) [2]=> float(-0.5) [3]=> float(NAN) [4]=> float(1) [5]=> float(NAN) [6]=> float(-2) [7]=> float(NAN) [8]=> float(4) [9]=> float(1) [10]=> float(NAN) [11]=> float(-1) [12]=> float(NAN) [13]=> float(1) [14]=> float(NAN) [15]=> float(-1) [16]=> float(NAN) [17]=> float(1) [18]=> float(INF) [19]=> float(INF) [20]=> float(INF) [21]=> float(INF) [22]=> float(1) [23]=> float(0) [24]=> float(0) [25]=> float(0) [26]=> float(0) [27]=> float(1) [28]=> float(1) [29]=> float(1) [30]=> float(1) [31]=> float(1) [32]=> float(1) [33]=> float(1) [34]=> float(1) [35]=> float(1) [36]=> float(0.25) [37]=> float(0.35355339059327) [38]=> float(0.5) [39]=> float(0.70710678118655) [40]=> float(1) [41]=> float(1.4142135623731) [42]=> float(2) [43]=> float(2.8284271247462) [44]=> float(4) }
Output for 5.4.0 - 5.5.35
Parse error: syntax error, unexpected '*' in /in/4kZAt on line 13
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/4kZAt on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/4kZAt on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/4kZAt on line 7
Process exited with code 255.