How to dynamicly create an array based upon a PHP buffer?

Discussion in 'PHP' started by vetting, Oct 10, 2007.

  1. #1
    I have a buffer that is doing some simple replace functions on HTML on an RSS feed.

    function callback($buffer){
    
    //Variables for buffer;
    $roverID="http://rover.ebay.com/rover/1/711-1751-2978-71/1?SID=EOA&AID=5463217&PID=2492909&mpre=";
    $ebayAddress = "http://cgi.ebay.com/";  
    $roverIDReplace="$roverID$ebayAddress";
    
    $buffer= str_replace($ebayAddress, $roverIDReplace, $buffer);
    $buffer = str_replace("</table><br><br>", "</table>", $buffer);
    return $buffer;
    
    
    }
    ob_start("callback"); ?>
    <td>
    <? 
    
    @include("index2.php"); ?>
    </td>
    <? ob_end_flush() ?>
    PHP:
    The resulting HTML is divided into lines. Can I assign a variable to each line that is returned in the buffer? I can then take each variable and put it in a block of HTML for each variable that exists.
     
    vetting, Oct 10, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Sorry, I don't understand your question. Do you want to split the HTML returned by the buffer into an array of lines? And then?

    You can split the HTML into a lines array by exploding the new line character - \n

    
    $lines = explode("\n", $buffer);
    
    PHP:
     
    nico_swd, Oct 11, 2007 IP