Posted By

13 on 08/04/06


Tagged


Versions (?)

16進法


 / Published in: PHP
 

  1. for($i=0;$i<count($divide);$i++){
  2. switch($divide[$i]){
  3. case "a":
  4. case "A":
  5. $res="10";
  6. break;
  7. case "b":
  8. case "B":
  9. $res="11";
  10. break;
  11. case "c":
  12. case "C";
  13. $res="12";
  14. break;
  15. case "d":
  16. case "D":
  17. $res="13";
  18. break;
  19. case "E":
  20. case "e";
  21. $res="14";
  22. break;
  23. case "F":
  24. case "f":
  25. $res="15";
  26. break;
  27. default:
  28. $res=$divide[$i];
  29. break;
  30. }
  31. if($i%2==0){
  32. $add=$res*16;
  33. }else{
  34. $result[]=$add+$res;
  35. }
  36. }

Report this snippet  

You need to login to post a comment.