Reputation: 1
First I declare a variable that I want to use in multiple arrays through the code. This is a snippet of it where it should work, but it doesn't:
The variable:
$test = '<div id="test"> dit is een test </div>';
The array:
$sections[] = array(
'title' => $test,
'icon' => '/img/icons/home.png'
);
The title is always empty :-/
Thanks !!
Upvotes: 0
Views: 104
Reputation: 450
Correct declaration is
$test = '<div id="test"> dit is een test </div>';
$sections = array(
'title' => $test,
'icon' => '/img/icons/home.png'
);
Upvotes: 1
Reputation: 763
Try with this code :
$test = '<div id="test"> dit is een test </div>';
$sections['title'] = $test;
$sections['icon'] = '/img/icons/home.png';
echo $sections['title'];
Upvotes: 0