3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $types = array('Normal','Fighting','Flying','Poison','Ground','Rock','Bug','Ghost','Steel','Fire','Water','Grass','Electric','Psychic','Ice','Dragon','Dark','Fairy',); $effect_vals = array( array(1, 1, 1, 1, 1,.5, 1, 0,.5, 1, 1, 1, 1, 1, 1, 1, 1, 1), array(2, 1,.5,.5, 1, 2,.5, 0, 2, 1, 1, 1, 1,.5, 2, 1, 2,.5), array(1, 2, 1, 1, 1,.5, 2, 1,.5, 1, 1, 2,.5, 1, 1, 1, 1, 1), array(1, 1, 1,.5,.5,.5, 1,.5, 0, 1, 1, 2, 1, 1, 1, 1, 1, 2), array(1, 1, 0, 2, 1, 2,.5, 1, 2, 2, 1,.5, 2, 1, 1, 1, 1, 1), array(1,.5, 2, 1,.5, 1, 2, 1,.5, 2, 1, 1, 1, 1, 2, 1, 1, 1), array(1,.5,.5,.5, 1, 1, 1,.5,.5,.5, 1, 2, 1, 2, 1, 1, 2,.5), array(0, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1,.5, 1), array(1, 1, 1, 1, 1, 2, 1, 1,.5,.5,.5, 1,.5, 1, 2, 1, 1, 2), array(1, 1, 1, 1, 1,.5, 2, 1, 2,.5,.5, 2, 1, 1, 2,.5, 1, 1), array(1, 1, 1, 1, 2, 2, 1, 1, 1, 2,.5,.5, 1, 1, 1,.5, 1, 1), array(1, 1,.5,.5, 2, 2,.5, 1,.5,.5, 2,.5, 1, 1, 1,.5, 1, 1), array(1, 1, 2, 1, 0, 1, 1, 1, 1, 1, 2,.5,.5, 1, 1,.5, 1, 1), array(1, 2, 1, 2, 1, 1, 1, 1,.5, 1, 1, 1, 1,.5, 1, 1, 0, 1), array(1, 1, 2, 1, 2, 1, 1, 1,.5,.5,.5, 2, 1, 1,.5, 2, 1, 1), array(1, 1, 1, 1, 1, 1, 1, 1,.5, 1, 1, 1, 1, 1, 1, 2, 1, 0), array(1,.5, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1,.5,.5), array(1, 2, 1,.5, 1, 1, 1, 1,.5,.5, 1, 1, 1, 1, 1, 2, 2, 1), ); $types_short = array_map( function($type){return substr($type, 0, 3);}, $types ); $format_prefix = '%-3s'; $format_header = str_repeat(' %3s', count($types)); $format_data = str_repeat(' %3f', count($types)); // header printf($format_prefix, ''); vprintf($format_header, $types_short); echo "\n"; // data foreach(array_map(NULL, $types_short, $effect_vals) as $val) { printf($format_prefix, $val[0]); vprintf($format_data, $val[1]); echo "\n"; }
based on GWRqG
Output for 5.3.0 - 7.2.0
Nor Fig Fly Poi Gro Roc Bug Gho Ste Fir Wat Gra Ele Psy Ice Dra Dar Fai Nor 1.000000 1.000000 1.000000 1.000000 1.000000 0.500000 1.000000 0.000000 0.500000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 Fig 2.000000 1.000000 0.500000 0.500000 1.000000 2.000000 0.500000 0.000000 2.000000 1.000000 1.000000 1.000000 1.000000 0.500000 2.000000 1.000000 2.000000 0.500000 Fly 1.000000 2.000000 1.000000 1.000000 1.000000 0.500000 2.000000 1.000000 0.500000 1.000000 1.000000 2.000000 0.500000 1.000000 1.000000 1.000000 1.000000 1.000000 Poi 1.000000 1.000000 1.000000 0.500000 0.500000 0.500000 1.000000 0.500000 0.000000 1.000000 1.000000 2.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 Gro 1.000000 1.000000 0.000000 2.000000 1.000000 2.000000 0.500000 1.000000 2.000000 2.000000 1.000000 0.500000 2.000000 1.000000 1.000000 1.000000 1.000000 1.000000 Roc 1.000000 0.500000 2.000000 1.000000 0.500000 1.000000 2.000000 1.000000 0.500000 2.000000 1.000000 1.000000 1.000000 1.000000 2.000000 1.000000 1.000000 1.000000 Bug 1.000000 0.500000 0.500000 0.500000 1.000000 1.000000 1.000000 0.500000 0.500000 0.500000 1.000000 2.000000 1.000000 2.000000 1.000000 1.000000 2.000000 0.500000 Gho 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 1.000000 1.000000 0.500000 1.000000 Ste 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 1.000000 1.000000 0.500000 0.500000 0.500000 1.000000 0.500000 1.000000 2.000000 1.000000 1.000000 2.000000 Fir 1.000000 1.000000 1.000000 1.000000 1.000000 0.500000 2.000000 1.000000 2.000000 0.500000 0.500000 2.000000 1.000000 1.000000 2.000000 0.500000 1.000000 1.000000 Wat 1.000000 1.000000 1.000000 1.000000 2.000000 2.000000 1.000000 1.000000 1.000000 2.000000 0.500000 0.500000 1.000000 1.000000 1.000000 0.500000 1.000000 1.000000 Gra 1.000000 1.000000 0.500000 0.500000 2.000000 2.000000 0.500000 1.000000 0.500000 0.500000 2.000000 0.500000 1.000000 1.000000 1.000000 0.500000 1.000000 1.000000 Ele 1.000000 1.000000 2.000000 1.000000 0.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 0.500000 0.500000 1.000000 1.000000 0.500000 1.000000 1.000000 Psy 1.000000 2.000000 1.000000 2.000000 1.000000 1.000000 1.000000 1.000000 0.500000 1.000000 1.000000 1.000000 1.000000 0.500000 1.000000 1.000000 0.000000 1.000000 Ice 1.000000 1.000000 2.000000 1.000000 2.000000 1.000000 1.000000 1.000000 0.500000 0.500000 0.500000 2.000000 1.000000 1.000000 0.500000 2.000000 1.000000 1.000000 Dra 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 0.500000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 1.000000 0.000000 Dar 1.000000 0.500000 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 1.000000 1.000000 0.500000 0.500000 Fai 1.000000 2.000000 1.000000 0.500000 1.000000 1.000000 1.000000 1.000000 0.500000 0.500000 1.000000 1.000000 1.000000 1.000000 1.000000 2.000000 2.000000 1.000000
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/KB2sh on line 27
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 T_FUNCTION, expecting ')' in /in/KB2sh on line 27
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/KB2sh on line 27
Process exited with code 255.