[Solved] How do I convert arrays into functions in PHP? [closed]


function states() {
  return array(
    "ct"=>"Connecticut",
    "ma"=>"Massachusetts",
    "nj"=>"New Jersey",
    "ny"=>"New York",
    "ri"=>"Rhode Island"
  );
}

function destinations() {
  return array(
    "easterncaribbean"=>"Eastern Caribbean",
    "southerncaribbean"=>"Southern Caribbean",
    "westerncaribbean"=>"Western Caribbean",
    "bermuda"=>"Bermuda",
    "bahamas"=>"Bahamas"
  );
}

$states       = states();
$destinations = destinations();

Is this what you were after? Functions are just recyclable snippets of code, so make sure you remember that.

NOTE: Your question didn’t make sense.

3

solved How do I convert arrays into functions in PHP? [closed]