I wonder if it's an issue of syntax somewhere. The code renders and outputs ok, but the php array values don't. function convert_ad_code($text) { include 'file that has ad_randoms, ad_title, and ad_body arrays'; $output = ''; $ad_var = "<div class='adv_div'>"; for ($tempIncVar = 0; $tempIncVar < 5; $tempIncVar++){ $ad_var = $ad_var . "<b>" . $ad_title[$ad_randoms[$tempIncVar]] . "</b><br>" . $ad_body[$ad_randoms[$tempIncVar]] . "<br><br>"; } $ad_var = $ad_var . "</div>"; $output = str_replace("###replaceme###",$ad_var,$text); return $output; } Code (markup): It ends up returning this: <div class="adv_div"> <b></b><br><span></span><br><br> <b></b><br><span></span><br><br> <b></b><br><span></span><br><br> <b></b><br><span></span><br><br> <b></b><br><span></span><br><br> </div> Code (markup): The array values never get shown I know that the include file is working, after working through a few errors, so the arrays are there.. I just don't know what I'm doing wrong regarding getting them to output. Any ideas?
What are $ad_title and $ad_randoms? Are you sure that the values in $ad_randoms are not crossing the array index boundary? Are you sure that $ad_title is defined?
$ad_title[$ad_randoms[$tempIncVar]] is $ad_randoms[$tempIncVar] an array inside of ad_title, or is it a 3d array which would be like $ad_title[$ad_randoms][$tempIncBar]. Its hard to tell without seeing the included file.