3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; }

preferences:
36.14 ms | 402 KiB | 5 Q