splitting lines in arrays?
- From: "tgiles" <tgiles@xxxxxxxxx>
- Date: 10 Apr 2005 03:32:06 -0700
Hi, all.
Been staring at this for a couple of hours now and I find myself
completely bewildered. I suppose it doesn't help that I'm a php newbie.
Nevertheless, I throw myself at your mercy.
I have an array which I am attempting to split off into a new array.
The first array is just a whole bunch of links like so:
http://www.example.com/query?track=http://www.somewhereelse.com/whatever.php
http://www.example.com/query?track=http://www.somewhereelse.com/whatever1.php
I managed to (sorta) successfully extract things out using preg_split:
foreach ($http_array as $i) {
$split = preg_split("/=/", $i, 2);
print "$split[1]<br>";
}
and the output looks like
http://www.somewhereelse.com/whatever.php
http://www.somewhereelse.com/whatever1.php
.... and so on...
The main goal is to parse an array much like the first bit at the top,
lop off anything after the first "=" in the line and then place it all
into another blank array so that I might do something else clever
elsewhere with it.
however, i've been totally unsuccessful in cleaning out blank entries
in the array (some creep in there, PREG_SPLIT_NO_EMPTY does not seem to
catch them) and cramming all of that into another new array. Been back
and forth between google and the fine php documents with little to show
for it.
eh. I give up. thoughts?
tom
.
- Follow-Ups:
- Re: splitting lines in arrays?
- From: Senator Jay Billington Bulworth
- Re: splitting lines in arrays?
- From: Janwillem Borleffs
- Re: splitting lines in arrays?
- Prev by Date: Re: what is the speed hit of "SELECT *" with MySql, as opposed to narrower database calls?
- Next by Date: Re: "not a valid JPEG file"
- Previous by thread: "not a valid JPEG file"
- Next by thread: Re: splitting lines in arrays?
- Index(es):
Relevant Pages
|