Posted By

ashmenon on 09/09/12


Tagged


Versions (?)

Beginner PHP Chapter 5 - Arrays - Code Block 7


 / Published in: PHP
 

Beginner PHP Chapter 5 - Arrays

  1. <?php
  2.  
  3. $name = 'Sandra James';
  4. $age = 45;
  5. $bloodType = 'B+';
  6. $height = 175;
  7. $weight = 65;
  8.  
  9. $patient1 = array(
  10. 'name' => $name,
  11. 'age' => $age,
  12. 'bloodType' => $bloodType,
  13. 'height' => $height,
  14. 'weight' => $weight
  15. );
  16.  
  17. //You can do that in a single line like shown previously, I just broke it into multiple lines to make it easier to see.
  18.  
  19. print_r($patient1);
  20.  
  21. /* That will show you the following:
  22.  
  23. Array(
  24. [name] => Sandra James
  25. [age] => 45
  26. [bloodType] => B+
  27. [height] => 175
  28. [weight] => 65
  29. )
  30.  
  31. */
  32.  
  33. ?>

Report this snippet  

You need to login to post a comment.