php - How to go thought multidimensional array? -


i have multidimensional array in php , need when user on www.web.com/index?page=graphicdesigner read parameter page get $_get["page"]. need go throught array , return array under current position.

so if on url above return echo $array["urlanchor"]; => graphic-designer

 $jobs = array(     "graphicdesigner" => array(         "urlanchor" => "graphic-designer",         "og:title" => "graphicdesigner ogtitle",         "og:description" => "graphicdesigner ogdescription",         "og:image" => "",         "og:url" => ""     ),     "uidesigner" => array(         "urlanchor" => "ui-designer",         "og:title" => "uidesigner ogtitle",         "og:description" => "uidesigner ogdescription",         "og:image" => "",         "og:url" => ""     ) ); 

how possible? can correct php code working well.

use query param key select array multidimensional array:

 $jobs = array(     "graphicdesigner" => array(         "urlanchor" => "graphic-designer",         "og:title" => "graphicdesigner ogtitle",         "og:description" => "graphicdesigner ogdescription",         "og:image" => "",         "og:url" => ""     ),     "uidesigner" => array(         "urlanchor" => "ui-designer",         "og:title" => "uidesigner ogtitle",         "og:description" => "uidesigner ogdescription",         "og:image" => "",         "og:url" => ""     ) );  $page = $_get["page"]; $pagearr = $jobs[$page]; echo $pagearr['urlanchor']; 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -