Create an array from variables and their values:


SUBMITTED BY: henry1874w

DATE: June 26, 2017, 5:07 p.m.

FORMAT: Text only

SIZE: 145 Bytes

HITS: 223

  1. <?php
  2. $firstname = "Peter";
  3. $lastname = "Griffin";
  4. $age = "41";
  5. $result = compact("firstname", "lastname", "age");
  6. print_r($result);
  7. ?>

comments powered by Disqus