runeveryday Posted October 22, 2011 Share Posted October 22, 2011 $col = 0; if ($num_products_count > 0) { while (!$specials_index->EOF) { $list_box_contents[$row][$col] = array('params' =>'<a href="#">' .zen_image(..). '</a>'), $col ++; } } now i want to pass some values<img src="1.jpg">,<img src="1.jpg">,<img src="2.jpg">,<img src="3.jpg">,<img src="4.jpg">,<img src="5.jpg"> to zen_image(..). how should i do? namely, if there are five loops.i want to change zen_image(..) output result to (<img src="1.jpg">,<img src="1.jpg">,<img src="2.jpg">,<img src="3.jpg">,<img src="4.jpg">,<img src="5.jpg">) Link to comment https://forums.phpfreaks.com/topic/249585-how-to-pass-the-value-in-php/ Share on other sites More sharing options...
MarPlo Posted October 22, 2011 Share Posted October 22, 2011 Hi, You can pass an array of values to zen_image( ), then parse those values in that function. For each loop add a value in that array: $col = 0; if ($num_products_count > 0) { while (!$specials_index->EOF) { $val[] = $col + 1; // or what value you want $list_box_contents[$row][$col] = array('params' =>'<a href="#">' .zen_image($val). '</a>'), $col ++; } } Link to comment https://forums.phpfreaks.com/topic/249585-how-to-pass-the-value-in-php/#findComment-1281374 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.