3v4l.org

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