What I want to do is remove the -
dash from the key in my array and then rebuild it back together with a space in place of the -
.
Sample array
$pages = array(
'Administrator' => array(
'network-administrator' => array('title' => 'Network '.$li_1, 'description' => 'Network '.$li_1.' '.$temp_content, 'post' => '<p>Network '.$li_1.' '.$temp_content.'.</p>'),
'database administrator' => array('title' => 'Database '.$li_1, 'description' => 'Database '.$li_1.' '.$temp_content, 'post' => '<p>Database '.$li_1.' '.$temp_content.'.</p>'),
),
'Analyst' => array(
'business systems analyst' => array('title' => 'Business Systems '.$li_2, 'description' => 'Business Systems '.$li_2.' '.$temp_content, 'post' => '<p>Business Systems '.$li_2.' '.$temp_content.'.</p>'),
'data-analyst' => array('title' => 'Data '.$li_2, 'description' => 'Data '.$li_2.' '.$temp_content, 'post' => '<p>Data '.$li_2.' '.$temp_content.'.</p>'),
),
);
As you can see there is a dash -
in some of the keys. Some already have spaces. The ones that have dashes need to be replaced with spaces.
I know this sounds weird, "why not just hard code them all with spaces" right? Well I need both arrays to check for conditions within my php scripts.
I'm not sure how to go about exploding the array, removing the dashes and then imploding it back together.
I think it would be something like this.
explode('-', $pages[ucfirst($occupation)];
then implode
implode(' ', $pages[ucfirst($occupation)]);
But I know that won't get all of the children arrays within the top level array.
Not sure how to go about this.
Help is appreciated!