Here is my code:
function get_roles(){
$role = array("1"=>"user management", "2"=>"create", "3"=>"update","4"=>"publish", "5"=>"delete", "6"=>"image upload", "7"=>"advertisement", "8"=>"department", "9"=>"category", "10"=>"sub category", "11"=>"grievance", "12"=>"feedback", "13"=>"help");
foreach($role as $x => $x_value) {
$result= $x_value;
}
return $result;
}
echo get_roles();
I want to return all values as json in php. But it returns only last value. How to do that? Is it possible to return all values?