Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. $allImmunities = array(
  3. 'poisonPercent' => '/images/gems/earth.gif',
  4. 'earthPercent' => '/images/gems/earth.gif',
  5. 'paralyzePercent' => '/images/gems/paralyze.gif',
  6. 'deathPercent' => '/images/gems/death.gif',
  7. 'energyPercent' => '/images/gems/energy.gif',
  8. 'icePercent' => '/images/gems/ice.gif',
  9. 'firePercent' => '/images/gems/fire.gif',
  10. 'physicalPercent' => '/images/gems/physical.gif',
  11. 'holyPercent' => '/images/gems/holly.gif',
  12. 'invisiblePercent' => '/images/gems/invisible.gif'
  13. );
  14.  
  15. $data = 'physicalPercent:10, icePercent:10, holyPercent:-10';
  16. foreach(explode(', ', $data) as $prop) {
  17. list($propName, $propVal) = explode(':', $prop);
  18. // $propName would be physicalPercent,
  19. // $propVal would be 10 for the first iteration, etc
  20.  
  21. // now get the image
  22. $img = $allImmunities[$propName];
  23.  
  24. echo $img ."\n";
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement