Arrays inside a PHP function

diggers

New Member
I'm trying to access an arrays data from inside a function but keep getting the error: Undefined varaible: status. Any idea how to correct this?\[code\]<?php$state = 'New York';function state_values($state){ switch ($state) { case 'New York': echo "State is $state"; $status = array("abbr" => "NY", "code" => "03"); return $status; break; case 'California': echo "State is $state"; $status = array("abbr" => "CA", "code" => "06"); return $status; break; case 'Washington': echo "State is $state"; $status = array("abbr" => "WA", "code" => "05"); return $status; break; }}# Call the functionstate_values($state);echo $status['abbr'];echo $status['code'];?>\[/code\]
 
Back
Top