Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $allImmunities = array(
- 'poisonPercent' => '/images/gems/earth.gif',
- 'earthPercent' => '/images/gems/earth.gif',
- 'paralyzePercent' => '/images/gems/paralyze.gif',
- 'deathPercent' => '/images/gems/death.gif',
- 'energyPercent' => '/images/gems/energy.gif',
- 'icePercent' => '/images/gems/ice.gif',
- 'firePercent' => '/images/gems/fire.gif',
- 'physicalPercent' => '/images/gems/physical.gif',
- 'holyPercent' => '/images/gems/holly.gif',
- 'invisiblePercent' => '/images/gems/invisible.gif'
- );
- $data = 'physicalPercent:10, icePercent:10, holyPercent:-10';
- foreach(explode(', ', $data) as $prop) {
- list($propName, $propVal) = explode(':', $prop);
- // $propName would be physicalPercent,
- // $propVal would be 10 for the first iteration, etc
- // now get the image
- $img = $allImmunities[$propName];
- echo $img ."\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement