Beginner PHP Chapter 5 - Arrays - Code Block 6


/ Published in: PHP
Save to your folder(s)

Beginner PHP Chapter 5 - Arrays


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. $name = 'Sandra James';
  4. $age = 45;
  5. $bloodType = 'B+';
  6. $height = 175;
  7. $weight = 65;
  8.  
  9. $patient1 = array($name,$age,$bloodType, $height, $weight); //This creates an array with Sandra's name, age, and blood type.
  10.  
  11. print_r($patient1);
  12.  
  13. /* That will show you the following:
  14.  
  15. Array(
  16. [0] => Sandra James
  17. [1] => 45
  18. [2] => B+
  19. [3] => 175
  20. [4] => 65
  21. )
  22.  
  23. */
  24.  
  25. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.