/    Sign up×
Community /Pin to ProfileBookmark

I suck at arrays

Ok, so here’s the page:

[url]http://carbonriot.summel.net/frootloops.php[/url]

When you click on the button, it pulls up some info.

What I need to do is pull the first value (thru explode() or something) from each array…then put them into a new array…

So like $images[] would = [0] => ‘asdf.gif’, [1] => ‘this.gif’.

How do I go about doing this? I suck at arrays, always have, always will ?.

Thanks guys,
Will

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@delr2691Nov 28.2006 — well.. you won't be able to do that cause what you're retrieving thru Ajax returns the text as html (it has a <pre> tag) and not as php code..

If you had php code with the array filled, then you could use this:

(assumin $arr is the main array)

[code=php]
foreach ($arr as $arr2) {
$res=split(",",$arr2['images']);
$images[]=$res[0];
}
print_r($images);
[/code]
Copy linkTweet thisAlerts:
@Mr_NerdNov 28.2006 — You could also use explode.

<?php

$a['images'] = "asdf.gif,asdf.gif,asdf.gif,asdf.gif,asdf.gif,asdf.gif,asdf.gif,asdf.gif";

$images = explode(",",$a['images']);

?>
[/Quote]
×

Success!

Help @tgrk35 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...