SHARE
TWEET

Untitled

a guest Sep 13th, 2017 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $set = isset($_GET['id']) ? $_GET['id'] : 1;
  4.  
  5. $users = array(
  6.     1 => array(
  7.         'name'      => 'dan',
  8.         'age'       => 14,
  9.         'country'   => 'england',
  10.     ),
  11.     2 => array(
  12.         'name'      => 'josh',
  13.         'age'       => 17,
  14.         'country'   => 'australlia',
  15.     ),
  16. );
  17. if(isset($users[$set]))
  18.  {
  19.     $user = $users[$set];
  20.  }
  21. else
  22.  {
  23.     die("<b>Warning:</b> A user with the ID ".$set." Does not exist!");
  24.  }
  25.  
  26. echo 'My name is ' . ucwords($user['name']) . ', i am ' . $user['age'] . ' Year\'s old, i am from ' . ucwords($user['country']) . ' and my user ID is ' . $set;
  27.  
  28. echo '<br /><br /><h1>All Users:</h1><br />';
  29. echo '<xmp>$users = ' . print_r($users,true) . '</xmp>';
  30. ?>
RAW Paste Data
Top