I have a problem, first off, I have a variable $num_newlines that changes to the amount of lines a files has. Then what I want to do is duplicate a line to one less than what $num_newlines equals. The line is:
$tweetcpitems->post('statuses/update', array('status' => wordFilter("The item $array[1] has been released on Club Penguin.")));
What I want to do next is that for each duplicate line I want the array number to change, for example:
$tweetcpitems->post('statuses/update', array('status' => wordFilter("The item *$array[1]* has been released on Club Penguin.")));
Then the second line to be like:
$tweetcpitems->post('statuses/update', array('status' => wordFilter("The item *$array[2]* has been released on Club Penguin.")));
Then the third line to have $array[3] and so on. The main problem is that I don’t want to have to manually add the lines of code and change the numbers because the variable $num_newlines is always changing. Any help would be HIGHLY appreciated as I’ve kept on researching on how to do this, but found nothing.
1 Answer