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), ); $effect = array(); foreach($types as $d_key => $defending){ foreach($types as $a_key => $attacking){ $effect[$defending][$attacking] = $effect_vals[$d_key][$a_key]; } } foreach($effect as $key => $child){ reset($effect); echo key($effect) === $key ? str_pad(substr($key, 0, 3), 7, " ", STR_PAD_LEFT) : str_pad(substr($key, 0, 3), 6, " ", STR_PAD_LEFT); } foreach($effect as $key => $child){ echo "\n" . substr($key, 0, 3); foreach($child as $c_key => $value){ reset($child); echo key($child) === $c_key ? str_pad(substr($value, 0, 3), 4, " ", STR_PAD_LEFT) : str_pad(substr($value, 0, 3), 6, " ", STR_PAD_LEFT); } }
based on J3bcC
Output for 4.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 1 1 1 1 0.5 1 0 0.5 1 1 1 1 1 1 1 1 1 Fig 2 1 0.5 0.5 1 2 0.5 0 2 1 1 1 1 0.5 2 1 2 0.5 Fly 1 2 1 1 1 0.5 2 1 0.5 1 1 2 0.5 1 1 1 1 1 Poi 1 1 1 0.5 0.5 0.5 1 0.5 0 1 1 2 1 1 1 1 1 2 Gro 1 1 0 2 1 2 0.5 1 2 2 1 0.5 2 1 1 1 1 1 Roc 1 0.5 2 1 0.5 1 2 1 0.5 2 1 1 1 1 2 1 1 1 Bug 1 0.5 0.5 0.5 1 1 1 0.5 0.5 0.5 1 2 1 2 1 1 2 0.5 Gho 0 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 0.5 1 Ste 1 1 1 1 1 2 1 1 0.5 0.5 0.5 1 0.5 1 2 1 1 2 Fir 1 1 1 1 1 0.5 2 1 2 0.5 0.5 2 1 1 2 0.5 1 1 Wat 1 1 1 1 2 2 1 1 1 2 0.5 0.5 1 1 1 0.5 1 1 Gra 1 1 0.5 0.5 2 2 0.5 1 0.5 0.5 2 0.5 1 1 1 0.5 1 1 Ele 1 1 2 1 0 1 1 1 1 1 2 0.5 0.5 1 1 0.5 1 1 Psy 1 2 1 2 1 1 1 1 0.5 1 1 1 1 0.5 1 1 0 1 Ice 1 1 2 1 2 1 1 1 0.5 0.5 0.5 2 1 1 0.5 2 1 1 Dra 1 1 1 1 1 1 1 1 0.5 1 1 1 1 1 1 2 1 0 Dar 1 0.5 1 1 1 1 1 2 1 1 1 1 1 2 1 1 0.5 0.5 Fai 1 2 1 0.5 1 1 1 1 0.5 0.5 1 1 1 1 1 2 2 1