Skip to content Skip to sidebar Skip to footer

Add Titles To Items From Array

I don't have that much experience with PHP and am looking for help with the following: I am fetching data from an SQL table that has a column 'countries' containing the name of a

Solution 1:

You can store a sub array inside $inputC like that :

foreach ($objDays->days as $days) {
    if(($days->dateMatch == "Yes") && ($days->locales != "")) {
        $inputC[] = array(
            "text" => explode(',', $days->locales),
            "desc" => $days->desc
        );
        $countC++;
    }
}

And modify your array_walk

array_walk($arrC, function (&$valC) { $valC = "<img src='images/icons/flags-32/flag_" . str_replace(" ", "_", $valC['text']) . ".png' alt='".$valC['desc']."' id='c" . $valC['text'] . "' style='width:32px' />&nbsp;" . $valC['text']; } );

edit : Your trim & array_merge will be certainly broken and need to be updated.


Post a Comment for "Add Titles To Items From Array"