Jump to content


Photo

multiarray value display


  • This topic is locked This topic is locked
2 replies to this topic

#1 brainstem

brainstem
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 29 September 2006 - 09:40 PM

All I am trying to do is get all the text from a file and display them like this:

your not
good enough
at php
yet to
figure this
crap out
brainstem growl

This is what I have, I can not for the life of my figure out a way around array_values
$massive = str_word_count(file_get_contents('massive.txt', 1));
$massivechunk = array_chunk($massive, 2, FALSE);
print_r(array_values($massivechunk));
for ($i = 0, $c = 10; $i < $c; $i++) {
foreach (($massivechunk[$i]) as $domassive) {
echo $domassive;
echo "<br>";
}
}



#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 29 September 2006 - 10:07 PM

Assuming "massive.txt" contains

your not good enough at php yet to figure this crap out brainstem growl

then
<?php
$massive = explode(' ', file_get_contents('massive.txt', 1));
$massivechunk = array_chunk($massive, 2);
foreach ($massivechunk as $chunk)
{
    echo join(' ',$chunk).'<br/>';
}
?>

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 29 September 2006 - 10:11 PM

Read forum guidelines and DO NOTdouble post
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users