I have a string which I want to use to define the data that is passed to printf.
The data is an array of structure:
//print_r() output of $data
[0] => Array
(
[id] => 1
[name] => joe blogs
[url] => /joeblogs/
)
//declare the format
$format = "<a href=\"%s\">%s</a>";
//declare the order (actually being pulled from db)
$order = "name,url";
//create an array of order for use later
$order_array = explode(",",$order);
now normally if the order wasn't dynamic I would do something like:
printf($format,$data[0][name],$data[0][url]);
the bit which is
$data[0][name],$data[0][url]
within the printf I want to automatically generate depending on the order of values within $order_array ($order_array may contain 'n' values so a foreach would be used probably).
Has anyone got any clues as how to generate the string above from the array $order_array and correctly pass it to printf?
Help would be GREATLY appreciate..
Cheers!