First, here's my code:
    $string="Why am I trying to do this crazy stuff when I should know
    $array=preg_split("[\s]", $string);
    // just a test of the preg_split results
    // print_r($array);
    $count = count($array);
    while ($container <= 20) {
        $box = strlen($array[$i]);
        $container=$container + $box;
    while ($j <= $i) {
        $returned_string .= $array[$j] . " ";
    print $returned_string . "<br>";
Works great on the first line, but I'm stuck on printing the remaining part
of the array using some sort of loop.  I've tried a few things but get
endless loops.  In the end I'd like to make this a function and just give it
the string and the container length as arguments.....can someone give me
some advice?


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to