How to assign a returned value from a function to a specific element in an array

I’m not sure I’ve worded the question very well, but basically I have a class with 3 functions that gets the profile image, real name, and latest tweet based on each element (twitter user names) in an array. What I am now trying to do is make it so each returned profile image when clicked, displays the the latest tweet from that particular person.

I don’t know how to make it so each user’s profile image is assigned/related to their tweet? At the moment the below code just outputs the profile image, name, and latest tweet of each of the twitter accounts defined in the array. Any help would be really appreciated.

Here is the code which executes the functions, along with the arrays used:

[php]$tweeters = array(‘JoeyEssex_’, ‘piersmorgan’, ‘BinkyFelstead’);

// Create all Tweeter objects
foreach ($tweeters as $i => $tweeter){
$tweeters[$i] = new Tweeter($tweeter, $tmhOAuth);

// Display all Tweeters
foreach ($tweeters as $tweeter){
echo ‘’;

echo '

Latest tweet from ’ . $tweeter->getName() . ‘:
foreach ($tweeter->getTweets() as $tweet){
echo $tweet[‘text’] . ‘
echo "Sent: " . $tweet[‘created_at’] . “


If you need to see the functions to answer this question then let me know. Cheers guys!

I don’t really understand the problem. Can you post the class?

Well, you could add an anchor around the image and use this to call a Javascript routine “onclick”.
Then, since you already have the tweet, you could just HIDE the tweets and then in the Javascript
routine just make the tweet visible.

Is that what you are looking for ? I agree with m@tt, the question is hidden from us a bit…

Sponsor our Newsletter | Privacy Policy | Terms of Service