Is is possible to change dynamically the array expression of a PHP foreach loop? -
i have few arrays store pages configurations, have same indexes , other similar configurations. name followed config
:
$welcomeconfig = array ( "title" => "welcome website", "other_settings" ); $contactsconfig = array ( "title" => "contact us", "other_settings" );
since don't want hard code every page custom foreach loop
wondered if possible define variable, concatenate config
string , use array expression.
i tried in way:
$custom = "welcome"; $custom .= "config"; foreach ($custom $config) { echo $config; }
but not work.
is there way it?
<?php $custom = "welcome"; $custom .= "config"; foreach ($$custom $config) { echo $config; } ?>
Comments
Post a Comment