If I understand you correctly, I call what you're trying to do "PHP
group by", and did a write up on it a few years back:
http://www.garfieldtech.com/blog/php-group-by-with-arrays
--Larry Garfield
On 7/18/13 8:43 AM, Karl-Arne Gjersøyen wrote:
Hello again.
In my program I have this:
mysql> S
Normally, what I do here is handle that in the loop to display the records
... so start by adding an order by clause to keep the dates together
SELECT * FROM transportdokument WHERE dato >= '16/7/2013' AND dato
<= '18/7/2013' order by dato
$prior_date = "";
$sHTML = "";
while($rows = mysql_fetc
Hello again.
In my program I have this:
mysql> SELECT * FROM transportdokument WHERE dato >= '16/7/2013' AND dato
<= '18/7/2013';
This list all reccrds for 3 days. I need a way to split it up for every day
even when the requst is as above and don't know in what way I can do it.
I like to have al
Hi,
First, read the help of 'preg_replace' at php.net.
Second: try this: preg_split('/\//',$sPath,$iMax)
Third: use explode: explode('/',)
Cheers,
Tamas
2011.12.13. dátummal, 21:33 időpontban Jack írta:
> OK so I have seen enough errors about split, so I decided to update my co
On Tue, Dec 13, 2011 at 15:33, Jack wrote:
> OK so I have seen enough errors about split, so I decided to update my code:
>
> return split("/", $sPath, $iMax);
>
>
>
> I tried:
>
> return preg_split("/", $sPath, $iMax);
>
> return preg_split("/", $sPath, $iMax, PREG_SPLIT_DELIM_CAPTURE);
>
>
>
>
OK so I have seen enough errors about split, so I decided to update my code:
return split("/", $sPath, $iMax);
I tried:
return preg_split("/", $sPath, $iMax);
return preg_split("/", $sPath, $iMax, PREG_SPLIT_DELIM_CAPTURE);
and a few other combinations, in the end always with errors. n
On Jul 1, 2009, at 11:33, Ashley Sheridan
wrote:
On Wednesday 01 July 2009 16:25:29 Matt Neimeyer wrote:
We've got a project
where "Date Of Attendance" is moving from a single type in
character field to an automatically built field based on a
DateBegin date field and a DateEnd date fi
It would be easier to standardize the input so you only have to run one
regular expression check to validate and then split the data up.
On Wed, Jul 1, 2009 at 10:33 AM, Ashley Sheridan
wrote:
> On Wednesday 01 July 2009 16:25:29 Matt Neimeyer wrote:
> > I haven't been able to find anything by go
On Wednesday 01 July 2009 16:25:29 Matt Neimeyer wrote:
> I haven't been able to find anything by googling... Does anyone know
> of any libraries that will split up date ranges? We've got a project
> where "Date Of Attendance" is moving from a single type in character
> field to an automatically bu
I haven't been able to find anything by googling... Does anyone know
of any libraries that will split up date ranges? We've got a project
where "Date Of Attendance" is moving from a single type in character
field to an automatically built field based on a DateBegin date field
and a DateEnd date fie
In news: [EMAIL PROTECTED]
- Greg Donald wrote :
>> On Sat, 15 Sep 2007, Joker7 wrote:
>>> I'm using the code below to display news articles-which works great
>>> apart from. I can control the number of articles,but I would like
>>> to add a link to the bottom of the page to the un-displayed
>>> a
On Sat, 15 Sep 2007, Joker7 wrote:
> I'm using the code below to display news articles-which works great apart
> from. I can control the number of articles,but I would like to add a link to
> the bottom of the page to the un-displayed articles ( nexted 5 articles and
> so on) any pointers would be
Hi,
I'm using the code below to display news articles-which works great apart
from. I can control the number of articles,but I would like to add a link to
the bottom of the page to the un-displayed articles ( nexted 5 articles and
so on) any pointers would be most welcome as most know my PHP ski
Jim Lucas wrote:
Can someone with a few more working grey cells prompt me with the
correct command to split a string.
The entered data is names, but I need to split the text up to the
first space or comma into one string, and the rest of the string
into
a second. It's the 'first either space or
On Wed, May 2, 2007 4:10 pm, Stut wrote:
> Richard Lynch wrote:
>> On Wed, May 2, 2007 4:55 am, Lester Caine wrote:
>>> Fredrik Thunberg wrote:
Lester Caine skrev:
> Can someone with a few more working grey cells prompt me with the
> correct command to split a string.
>
> The
On May 2, 2007, at 4:10 PM, Stut wrote:
Richard Lynch wrote:
On Wed, May 2, 2007 4:55 am, Lester Caine wrote:
Fredrik Thunberg wrote:
Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the
correct command to split a string.
The entered data is names, but I ne
Stut wrote:
Richard Lynch wrote:
On Wed, May 2, 2007 4:55 am, Lester Caine wrote:
Fredrik Thunberg wrote:
Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the
correct command to split a string.
The entered data is names, but I need to split the text up to the
Richard Lynch wrote:
On Wed, May 2, 2007 4:55 am, Lester Caine wrote:
Fredrik Thunberg wrote:
Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the
correct command to split a string.
The entered data is names, but I need to split the text up to the
first space
On Wed, May 2, 2007 4:55 am, Lester Caine wrote:
> Fredrik Thunberg wrote:
>> Lester Caine skrev:
>>> Can someone with a few more working grey cells prompt me with the
>>> correct command to split a string.
>>>
>>> The entered data is names, but I need to split the text up to the
>>> first space
On Wed, May 2, 2007 3:55 am, Lester Caine wrote:
> Can someone with a few more working grey cells prompt me with the
> correct
> command to split a string.
>
> The entered data is names, but I need to split the text up to the
> first space
> or comma into one string, and the rest of the string in
Stut wrote:
Alternatively you could use split to break the string into the two
parts, which is probably more efficient...
list($part1, $part2) = split('[ ,]', $myString);
Oops, this should have a third parameter...
list($part1, $part2) = split('[ ,]', $myString, 2);
-Stut
--
PHP General Ma
Fredrik Thunberg wrote:
Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the
correct command to split a string.
The entered data is names, but I need to split the text up to the
first space or comma into one string, and the rest of the string into
a second. I
Fredrik Thunberg wrote:
Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the
correct command to split a string.
The entered data is names, but I need to split the text up to the
first space or comma into one string, and the rest of the string into
a second. I
Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the
correct command to split a string.
The entered data is names, but I need to split the text up to the first
space or comma into one string, and the rest of the string into a
second. It's the 'first either spa
Can someone with a few more working grey cells prompt me with the correct
command to split a string.
The entered data is names, but I need to split the text up to the first space
or comma into one string, and the rest of the string into a second. It's the
'first either space or comma' that elu
Labunski wrote:
> I need to split a long string into smaler chunks (an array), as a separator
> using every third \n (and not just every \n).
> I could use 'explode', but then it would produce too many chunks.
php.net/preg_split
Cheers,
David
--
David Grant
http://www.grant.org.uk/
--
PHP Ge
Split them using explode and then combine the ones you need to combined.
Hope this helps.
--
Anas Mughal
On 12/19/05, Labunski <[EMAIL PROTECTED]> wrote:
>
> I need to split a long string into smaler chunks (an array), as a
> separator
> using every third \n (and not just every \n).
> I could us
[snip]
I need to split a long string into smaler chunks (an array), as a separator
using every third \n (and not just every \n).
I could use 'explode', but then it would produce too many chunks.
[/snip]
http://us2.php.net/manual/en/function.chunk-split.php
--
PHP General Mailing List (http://ww
I need to split a long string into smaler chunks (an array), as a separator
using every third \n (and not just every \n).
I could use 'explode', but then it would produce too many chunks.
Thank you in advance!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.p
On 11/14/05, Ördögh László <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I would like to split or explode strings in a way that
> quoted strings inside the strings should remain.
> e.g.:
>
> "first second \"third third\" fourth \"fifth fifth fifth\""
>
> after the split I need:
>
> "first"
> "second"
> "
Ördögh László wrote:
I would like to split or explode strings in a way that
quoted strings inside the strings should remain.
e.g.:
"first second \"third third\" fourth \"fifth fifth fifth\""
after the split I need:
"first"
"second"
"third third"
"fourth"
"fifth fifth fifth"
I love explode(),
Hello,
I would like to split or explode strings in a way that
quoted strings inside the strings should remain.
e.g.:
"first second \"third third\" fourth \"fifth fifth fifth\""
after the split I need:
"first"
"second"
"third third"
"fourth"
"fifth fifth fifth"
Is there a simple way to achieve
Le 27-sept.-05 à 23:52, Philip Hallstrom a écrit :
http://us3.php.net/manual/en/function.wordwrap.php
thanks a lot!
$newtext = wordwrap($row[1], 50, "\n");
echo $newtext;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
if "chunk_split" function split the line of text (here on 50 char)
I was wondering if there exists one function who take care if
the 50 char is in the middle of the word and split the line
first "empty space" before the word or just after?
$newstring = chunk_split($row[1], 50, '');
echo $newstrin
Hi,
if "chunk_split" function split the line of text (here on 50 char)
I was wondering if there exists one function who take care if
the 50 char is in the middle of the word and split the line
first "empty space" before the word or just after?
$newstring = chunk_split($row[1], 50, '');
echo $n
a[],$a[],$a[]) = $match;
This is fine as long as there's precisely three escape sequences in the
string; if there's an arbitrary number, that won't work. I've posted
another solution already using preg_match_all() that will.
> - Original Message -
> From: <[
xit;
Mark Cain
- Original Message -
From: <[EMAIL PROTECTED]>
To:
Sent: Tuesday, June 14, 2005 8:13 PM
Subject: [PHP] split()?
> How would I do this ?
>
> Take this string and return everything between [ ] as an array output
doesnt
> have to inlude [ ]
> $rr="th
How would I do this ?
Take this string and return everything between [ ] as an array output doesnt
have to inlude [ ]
$rr="thisscritjajsj[ OUT1 ]ajdamsda;sjo;tkpdk[ OUT2 ]sdfmjs[ OUT3 ]dfjlsd";
$a = some function
echo '';
print_r($a);
[0] => [ OUT1 ]
[1] => [ OUT2 ]
[2] => [ OUT3
ist($fname, $lname) = split('[/\s+/]', "$_POST[username]");
Cheers,
Prathap
-- Original Message ---
From: Russ <[EMAIL PROTECTED]>
To: PHP General
Sent: Sun, 10 Apr 2005 18:27:34 -0700
Subject: [PHP] Split command problem
> I have been trying to
On Monday 11 April 2005 09:27, Russ wrote:
> I have been trying to get the following code working. I keep getting an
> error on line nine.
And the error is?
> It looks simular to the example in the PHP online
> manual. If I substitute a print command for line nine I get the correct
> information
On Apr 10, 2005 8:27 PM, Russ <[EMAIL PROTECTED]> wrote:
> I have been trying to get the following code working. I keep getting an error
> on line nine. It looks simular to the example in the PHP online manual. If I
> substitute a print command for line nine I get the correct information from
> $_P
I have been trying to get the following code working. I keep getting an error
on line nine. It looks simular to the example in the PHP online manual. If I
substitute a print command for line nine I get the correct information from
$_POST[username]. I must be missing or have an extra a quote but
* Thus wrote Curt Zirzow:
>
> $shortString = implode('', explode('', $string, $nth));
ignore this.
Curt
--
The above comments may offend you. flame at will.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
* Thus wrote Janet Valade:
> Brian Dunning wrote:
>
> >Thanks Chris, that works great, but it's not doing what I want. I'm just
> >trying to get the position of the 3rd occurrence (for example) of
> >''. So I'm looking for a function that will return the value 19,
> >given the above example str
I don't understand why explode won't work for you.
The explode solution is working. Thanks very much to everyone who
replied with so much great information!
- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Brian Dunning wrote:
Thanks Chris, that works great, but it's not doing what I want. I'm just
trying to get the position of the 3rd occurrence (for example) of
''. So I'm looking for a function that will return the value 19,
given the above example string.
From your first post, you just want to
On Wed, 2004-09-22 at 12:31, Brian Dunning wrote:
> > > $string = 'onetwothreefourfive';
> > $nthPos = 4;
> > $tmpArr = explode( '', $string );
> > $nthString = $tmpArr[($nthPos - 1)];
> > ?>
>
> Thanks Chris, that works great, but it's not doing what I want. I'm
> just trying to get the
ould get 'three') all you
have to do is:
$out[1][1][1] => 14
Just my .2 euros...
Silvio Porcellana
- Original Message -
From: "Brian Dunning" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 22, 2004 5:54 PM
Subject: [PHP] Split h
twothreefourfive';
$nthPos = 4;
$tmpArr = explode( '', $string );
$nthString = $tmpArr[($nthPos - 1)];
?>
Thanks Chris, that works great, but it's not doing what I want. I'm
just trying to get the position of the 3rd occurrence (for example) of
''. So I'm looking for a function that will re
> I've been RTFMing for about an hour and I can't find a string function
> to split haystack 'onetwothreefourfive' at the nth
> occurrence of needle ''. strpos gives me the position of the first
> needle, and strrpos gives me the position of the last needle. But I'm
> looking for the position o
I've been RTFMing for about an hour and I can't find a string function
to split haystack 'onetwothreefourfive' at the nth
occurrence of needle ''. strpos gives me the position of the first
needle, and strrpos gives me the position of the last needle. But I'm
looking for the position of one of t
> * Thus wrote Sandip Bhattacharya:
>> This stumped me badly in my present project. Is this a bug or a feature
>> in
>> PHP? I am trying to split a string into two, where only one half (and
>> the
>> delimiter) is present.
>>
>>
>> IN PERL
>> ==
>> [EMAIL PROTECTED
just PHP being its own language.
Cheers,
Andrew Martinez
RubyBay Inc.
> -Original Message-
> From: Curt Zirzow [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 16, 2004 10:45 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] split behaviour differences in perl an
* Thus wrote Sandip Bhattacharya:
> This stumped me badly in my present project. Is this a bug or a feature in
> PHP? I am trying to split a string into two, where only one half (and the
> delimiter) is present.
>
>
> IN PERL
> ==
> [EMAIL PROTECTED] ~]$ cat s1.p
Sandip Bhattacharya wrote:
This stumped me badly in my present project. Is this a bug or a feature in
PHP? I am trying to split a string into two, where only one half (and the
delimiter) is present.
[ trim ]
IN PHP
===
[EMAIL PROTECTED] ~]$ cat s1.php
[EMAIL PROTECTED] sql]$ p
This stumped me badly in my present project. Is this a bug or a feature in
PHP? I am trying to split a string into two, where only one half (and the
delimiter) is present.
IN PERL
==
[EMAIL PROTECTED] ~]$ cat s1.pl
@t = split(/,/ , "a,b");
$len = $#t + 1;
print "
Hi, I'm trying to get a 500 character split of a string, I only want
about the fist 500 characters, I would like to split on a space, which I
have managed to do so far, but I would also like the split to not take
place inside an HTML tag, so that I don't end up with weird looking pages.
I was t
On Tue, 2004-02-17 at 22:28, Jochem Maas wrote:
> that was the idea: you can't have your pie at eat it right? ;-)
Heh, I thought you might have done that deliberately. :)
> seriously thought, John Taylor-Johnston was asking for help on while
> loops and I thought I'd give him some brainfood (i.e
Adam Bregenzer wrote:
On Tue, 2004-02-17 at 15:22, Jochem Maas wrote:
$applePie = array(1,2,3,4,5,6,7,8);
while ($pieceOfPie = array_shift($applePie)) {
echo $pieceOfPie; // want some pie?
}
Careful, that will eat your array as well. When the while loop finishes
you won't have any pie
On Tue, 2004-02-17 at 15:22, Jochem Maas wrote:
> $applePie = array(1,2,3,4,5,6,7,8);
>
> while ($pieceOfPie = array_shift($applePie)) {
> echo $pieceOfPie; // want some pie?
> }
Careful, that will eat your array as well. When the while loop finishes
you won't have any pieces of pie left!
save a function call:
$applePie = array(1,2,3,4,5,6,7,8);
while ($pieceOfPie = array_shift($applePie)) {
echo $pieceOfPie; // want some pie?
}
Stuart wrote:
John Taylor-Johnston wrote:
Can I while this? Not sure how to go about it?
while ($pieces exist) {
echo $pieces[i];
}
This will
On Tue, 2004-02-17 at 11:02, Adam Bregenzer wrote:
> Try while(each($pieces)) or foreach($pieces as $piece)
Brain to fingers problem:
while($piece = each($pieces))
http://www.php.net/each
http://www.php.net/foreach
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--
PHP General
John Taylor-Johnston wrote:
Can I while this? Not sure how to go about it?
while ($pieces exist) {
echo $pieces[i];
}
This will empty the array so you might want to do this on a copy of it
depending on whether it will be needed later in the script...
while (count($pieces) > 0)
{
echo array_s
On Tue, 2004-02-17 at 11:03, John Taylor-Johnston wrote:
> Can I while this? Not sure how to go about it?
>
> $pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
> $pieces = explode(" ", $pizza);
> echo $pieces[0]; // piece1
> echo $pieces[1]; // piece2
Try while(each($pieces)) or foreach($pie
Can I while this? Not sure how to go about it?
while ($pieces exist) {
echo $pieces[i];
}
Thanks,
John
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
http://www.php.net/manual/en/function.explode.php
h
thanx for the help. i got it. when i saw what happened when i put the + at
the end i found what i needed.
split('[.!?] ', $data)
this way it only breaks them up if the . or ! or ? is followed by a space.
thanx again for the help.
"Eugene Lee" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTE
On Wed, Nov 12, 2003 at 09:48:37PM -0600, erythros wrote:
:
: trying to use split(). i want to split a paragraph by sentence. so of course
: i used split('[.!?]', $data). but then i noticed i use ... or every now
: and again at the end of a sentence. i don't know how to do this though...
How
--- erythros <[EMAIL PROTECTED]> wrote:
> trying to use split(). i want to split a paragraph by sentence. so of
> course i used split('[.!?]', $data). but then i noticed i use ... or
> every now and again at the end of a sentence.
Maybe you could explode on a period followed by a space? I wou
trying to use split(). i want to split a paragraph by sentence. so of course
i used split('[.!?]', $data). but then i noticed i use ... or every now
and again at the end of a sentence. i don't know how to do this though...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, vis
Hi,
Thanks, that worked like a charm. I didn't realize that | was a special
character, that's good to know. I also agree with the explode method.
Seems quicker. Thanks!
-Dan Joseph
> The | character is a special character in regular expressions,
> which split()
> expects. So, you can
From: "Dan Joseph" <[EMAIL PROTECTED]>
> I'm getting the following error:
>
> [Tue Nov 4 10:01:53 2003] [error] PHP Warning: split() [ href='http://www.php.net/function.split'>function.split]: REG_EMPTY in
> /usr/local/apache/htdocs-chm/import_data.php on line 26
>
> Here is the code in question
Hi All,
I'm getting the following error:
[Tue Nov 4 10:01:53 2003] [error] PHP Warning: split() [function.split]: REG_EMPTY in
/usr/local/apache/htdocs-chm/import_data.php on line 26
Here is the code in question:
$line = fgets( $file );
> I want to make a loop.Like $a = "123"; //$a is One two threw not
> hundred...
> and i want to make for each $a then $b = $a + 2
>
> The output will be.
> 3 (1+2)
> 4 (2+2)
> 5 (3+2)
>
> Any example?
$a = "123";
$c = '';
$b = strlen($a);
for($x=0;$x<$b;$x++)
{ $c .= $a{$x} +2; }
echo $c;
---
This:
$word = 'test';
$len = strlen($word);
for ($a = 0; $a < $len; $a++) {
print $word{$a} . "\n";
}
Will print:
t
e
s
t
Regards,
Philip
On Thu, 27 Mar 2003, Oden Odenius wrote:
> I have $word = "test";
> And i want to split it like
> t
> e
> s
> t
>
> I want to make a loop.Like $a =
On 27-Mar-2003 Oden Odenius wrote:
> I have $word = "test";
> And i want to split it like
> t
> e
> s
> t
>
> I want to make a loop.Like $a = "123"; //$a is One two threw not
> hundred...
> and i want to make for each $a then $b = $a + 2
>
> The output will be.
> 3 (1+2)
> 4 (2+2)
> 5 (3+2)
>
>
I have $word = "test";
And i want to split it like
t
e
s
t
I want to make a loop.Like $a = "123"; //$a is One two threw not hundred...
and i want to make for each $a then $b = $a + 2
The output will be.
3 (1+2)
4 (2+2)
5 (3+2)
Any example?
Btw sorry for my english
--
Programmers are tools for c
Is there a way to split a string without using something like this:
$keywords=preg_split("/[?!.]/", "this ! Is a possible
test",PREG_SPLIT_DELIM_CAPTURE);
My php version doesn't seem to support the flags, and I want to know
which delimiter the string was splitted by.
Kind regards,
Simon De Deyne
: "N. Pari Purna Chand" <[EMAIL PROTECTED]>
Sent: Sunday, September 08, 2002 2:33 PM
Subject: Re: [PHP] split() - not working in this case
> On Sun, 8 Sep 2002, N. Pari Purna Chand wrote:
>
> > $to = " abcd <[EMAIL PROTECTED]>, efgh <[EMAIL PROTECTED]&g
On Sun, 8 Sep 2002, N. Pari Purna Chand wrote:
> $to = " abcd <[EMAIL PROTECTED]>, efgh <[EMAIL PROTECTED]>" ;
> Now split() in the following function*** is notworking as needed.
> ie, I'm getting
> $tos[0] = "abcd";
> $tos[1] = "efgh";
split didn't do anything wrong. use your browser's "view
, efgh <[EMAIL PROTECTED]>";
$tos=split_addresses($to);
echo $tos[1];
?>
echos efgh <[EMAIL PROTECTED]> ?? Whats the problem? Maybe you output to a browser
and don't see <[EMAIL PROTECTED]> cause its between <>
Op zondag 08 september 2002 10:17, schreef N. Pari Purna Chand:
> I have a string
I have a string
$to = " abcd <[EMAIL PROTECTED]>, efgh <[EMAIL PROTECTED]>" ;
I want a function returning an array of
indivial names+mailids like from the $to seperated by ","
something like
$tos[0] = "abcd <[EMAIL PROTECTED]>";
$tos[1] = "efgh <[EMAIL PROTECTED]>";
Now split() in the followin
> >> =Hmm, I'm still come at it from the other way around (all due respect to
> >> Jason) - but then I don't recall OpSys details, or know if there is a
> >> utility/tool for the job in your choice of OpSys.
> >
> >Well unless it's a *really* obscure OS I'm sure there must be some readily
> >avai
>> =Hmm, I'm still come at it from the other way around (all due respect to
>> Jason) - but then I don't recall OpSys details, or know if there is a
>> utility/tool for the job in your choice of OpSys.
>
>Well unless it's a *really* obscure OS I'm sure there must be some readily
>available file
On Thursday 24 January 2002 20:46, DL Neil wrote:
> > > > Making any sense?
> > >
> > > Year, so I have to do it manually (thought someone could preveting me
> > > from reinvent the wheel... ;-)
> > >
> > > > What are you really trying to achieve?
> > >
> > > I'm trying to split a large binary fil
> > > Making any sense?
> >
> > Year, so I have to do it manually (thought someone could preveting me from
> > reinvent the wheel... ;-)
> >
> > > What are you really trying to achieve?
> >
> > I'm trying to split a large binary file (>2 GB) into peaces of 700 MB to
> > burn it on a cd. It's a par
On Thursday 24 January 2002 15:34, Martin Thoma wrote:
> Hi and thaks for your answer.
> ...
>
> > Making any sense?
>
> Year, so I have to do it manually (thought someone could preveting me from
> reinvent the wheel... ;-)
>
> > What are you really trying to achieve?
>
> I'm trying to split a lar
Hi and thaks for your answer.
...
> Making any sense?
Year, so I have to do it manually (thought someone could preveting me from reinvent
the wheel... ;-)
> What are you really trying to achieve?
I'm trying to split a large binary file (>2 GB) into peaces of 700 MB to burn it on a
cd. It's a
Hello! Is there a PHP-function to split binary files into pieces of a
several size and glue them together later?
Martin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrat
Hi,
I have saved an email as text-file, and want to get header and body out of
the file!
(header and body are seperated by the first empty line!)
so I do:
list($header,$body)=split("\n\n",join('',file($FILE)),2);
then I need the body's lines as array:
$body=split("\n",$body);
but this line gives
4:32 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re[3]: [PHP] split array in 2 halfs
$smallarray1=array_slice($bigarray,0,3);
$smallarray2=array_slice($bigarray,3,3);
On Wed, 31 Oct 2001 23:25:55 -0800, Daniel Harik wrote:
>Want to split it in half
>
>1 Big array:
>
>1
&g
Correction:
$count = count($array);
$count = $count/2;
$count = round($count,0);
"Liz Fulghum" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You could also grab the midpoint of the array:
>
> $count = round(count($array), 0);
>
> then populate your new arra
You may find this helpful:
$arr = array('a','b','c','d','e');
$second_half = array_splice($arr,floor(sizeof($arr)/2));
print_r($arr); // Array ( [0] => a [1] => b )
print_r($second_half); // Array ( [0] => c [1] => d [2] => e )
In the above, $second_half will be one la
You could also grab the midpoint of the array:
$count = round(count($array), 0);
then populate your new arrays by using a foreach loop:
$x = 0;
foreach($array as $key => $value) {
if ($x <=$count) {
$array1[] = $value;
} else {
$array2[] = $value;
}
$x++;
}
"D
ber 2001 07:25
Subject: Re[2]: [PHP] split array in 2 halfs
> Want to split it in half
>
> 1 Big array:
>
> 1
> 2
> 3
> 4
> 5
> 6
>
> Want to make
>
>
> 1 Small array:
>
> 1
> 2
> 3
>
> 2 Small array:
> 4
> 5
> 6
>
Don't forget that you should clear out that memory space, especially if it's
an array of arrays or an array of objects or something along those lines:
unset($bigarray);
Just good programming practice, that's all. I doubt it would ever be a
problem on today's servers, but it's still a good idea.
$smallarray1=array_slice($bigarray,0,3);
$smallarray2=array_slice($bigarray,3,3);
On Wed, 31 Oct 2001 23:25:55 -0800, Daniel Harik wrote:
>Want to split it in half
>
>1 Big array:
>
>1
>2
>3
>4
>5
>6
>
>Want to make
>
>
>1 Small array:
>
>1
>2
>3
>
>2 Small array:
>4
>5
>6
>
>Thank You
>
>
--
M
take a look at the manual
http://www.php.net/manual/en/function.array-slice.php
it will show you the right way to do it
jim
- Original Message -
From: "Daniel Harik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 31, 2001 11:25 PM
Subje
Want to split it in half
1 Big array:
1
2
3
4
5
6
Want to make
1 Small array:
1
2
3
2 Small array:
4
5
6
Thank You
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administr
Based on what criteria? if you just want to split the array at element 30,
you could use array_splice to get the necessary data...
- Original Message -
From: "Daniel Harik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 01, 2001 2:16 AM
Subject
Good evening
I was wondering how can I split, array that has 60 elements in it,
into 2 arrays with 30 elements each?
Thank You very much and have a good night :-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMA
1 - 100 of 130 matches
Mail list logo