If rewriting this function saves me .0001 milliseconds of processing
time, can I spend that time watching baseball instead of writing code??
:) Kristina
> At 12:06 PM -0400 7/3/08, John Campbell wrote:
> >On Thu, Jul 3, 2008 at 11:11 AM, Urb LeJeune <[EMAIL PROTECTED]>
wrote:
> >> Is this the
Brian O'Connor wrote:
>> $p = explode('|',$y);
>> for($i=0,$c = count($p);$i<$c;) {
>> echo $p[$i++],' ', $p[$i++], "\n";
>> }
>
> I believe this will miss the first element of $p; you need instead:
>
> for ( $i = -1, $c = count( $p ); $i < $c; ) {
If
John Campbell wrote:
> If you start from -1, then you would need to use ++$i rather than $i++
aha, the first *really good* illustration of the difference that I have
ever seen ;-)
--
=
Michael Southwell
Vice President, Education
NYPHP TRAINING: http://nyphp.com/Training/Inde
On Thu, Jul 3, 2008 at 1:32 PM, John Campbell <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 3, 2008 at 12:45 PM, Michael Southwell
> <[EMAIL PROTECTED]> wrote:
> > John Campbell wrote:
> >>
> >> $p = explode('|',$y);
> >> for($i=0,$c = count($p);$i<$c;) {
> >> echo $p[$i++],' ', $p[$i++], "\n";
> >> }
At 12:06 PM -0400 7/3/08, John Campbell wrote:
On Thu, Jul 3, 2008 at 11:11 AM, Urb LeJeune <[EMAIL PROTECTED]> wrote:
Is this the same thing that you are trying to accomplish with the
for loop?
Yes but increments (or decrements) are executed much more efficiently than
additions.
This is
No. $i++ returns the value of $i, then increments it.
On Thu, Jul 3, 2008 at 12:45 PM, Michael Southwell <
[EMAIL PROTECTED]> wrote:
> John Campbell wrote:
>
>> $p = explode('|',$y);
>> for($i=0,$c = count($p);$i<$c;) {
>> echo $p[$i++],' ', $p[$i++], "\n";
>> }
>>
>
> I believe this will miss t
On Thu, Jul 3, 2008 at 12:45 PM, Michael Southwell
<[EMAIL PROTECTED]> wrote:
> John Campbell wrote:
>>
>> $p = explode('|',$y);
>> for($i=0,$c = count($p);$i<$c;) {
>> echo $p[$i++],' ', $p[$i++], "\n";
>> }
>
> I believe this will miss the first element of $p; you need instead:
>
> for ( $i = -1,
>> and aren't you glad this guy asked this question?
>
> No.
>
Grr... I misread what you wrote... I thought you wrote, "are you the
guy that asked the question?" ... I need a vacation.
___
New York PHP Community Talk Mailing List
http://lists.nyphp.o
On Thu, Jul 3, 2008 at 1:22 PM, John Campbell <[EMAIL PROTECTED]> wrote:
> On Thu, Jul 3, 2008 at 1:10 PM, David Mintz <[EMAIL PROTECTED]> wrote:
>>
>>
>> On Thu, Jul 3, 2008 at 12:45 PM, Michael Southwell
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> John Campbell wrote:
$p = explode('|',$y);
>>
On Thu, Jul 3, 2008 at 1:10 PM, David Mintz <[EMAIL PROTECTED]> wrote:
>
>
> On Thu, Jul 3, 2008 at 12:45 PM, Michael Southwell
> <[EMAIL PROTECTED]> wrote:
>>
>> John Campbell wrote:
>>>
>>> $p = explode('|',$y);
>>> for($i=0,$c = count($p);$i<$c;) {
>>> echo $p[$i++],' ', $p[$i++], "\n";
>>> }
>>
On Thu, Jul 3, 2008 at 12:45 PM, Michael Southwell <
[EMAIL PROTECTED]> wrote:
> John Campbell wrote:
>
>> $p = explode('|',$y);
>> for($i=0,$c = count($p);$i<$c;) {
>> echo $p[$i++],' ', $p[$i++], "\n";
>> }
>>
>
> I believe this will miss the first element of $p; you need instead:
>
> for ( $i =
John Campbell wrote:
$p = explode('|',$y);
for($i=0,$c = count($p);$i<$c;) {
echo $p[$i++],' ', $p[$i++], "\n";
}
I believe this will miss the first element of $p; you need instead:
for ( $i = -1, $c = count( $p ); $i < $c; ) {
--
=
Michael Southwell
Vice President, Education
On Thu, Jul 3, 2008 at 11:11 AM, Urb LeJeune <[EMAIL PROTECTED]> wrote:
> Is this the same thing that you are trying to accomplish with the
> for loop?
>
> Yes but increments (or decrements) are executed much more efficiently than
> additions.
This is wrong for three reasons:
1) 4 ++ increments is
Dan Cech wrote:
Urb LeJeune wrote:
An unknown string,its format is:
y="tnk81|98.8$|yuhj78t|32.6$|tris78y|459.78$|."
..
You could write this a little more simply as:
$parts = explode('|',$y);
$cnt = count($parts);
for ($i = 0;$i < $cnt - 1;$i += 2) {
echo $parts[$i] .' '. $parts[$i+1]
Is this the same thing that you are trying to accomplish with the
for loop?
Yes but increments (or decrements) are executed much more efficiently
than additions.
Urb
for($Sub1=0,$Sub2=1;$Sub2<=$Count;)
{
echo "$Parts[$Sub1] $Parts[Sub2]\n";
$Sub1+=2;
$Sub2+=2;
}
I just want to k
Quoting Urb LeJeune <[EMAIL PROTECTED]>:
An unknown string,its format is:
y="tnk81|98.8$|yuhj78t|32.6$|tris78y|459.78$|."
list($Parts) = explode("|",$y);
$Count = count($Parts);
for($Sub1=0,$Sub2=1;$Sub2<=$Count;$Sub1++,$Sub1++,$Sub2++,$Sub2++)
echo "$Parts[$Sub1] $Parts[Sub2]\n";
T
Is this the same thing that you are trying to accomplish with the
for loop?
for($Sub1=0,$Sub2=1;$Sub2<=$Count;)
{
echo "$Parts[$Sub1] $Parts[Sub2]\n";
$Sub1+=2;
$Sub2+=2;
}
I just want to know if I read it correctly.
Thanks,
Nestor :-)
On Thu, Jul 3, 2008 at 7:36 AM, Urb LeJeune <[EMAI
Urb LeJeune wrote:
An unknown string,its format is:
y="tnk81|98.8$|yuhj78t|32.6$|tris78y|459.78$|."
list($Parts) = explode("|",$y);
$Count = count($Parts);
for($Sub1=0,$Sub2=1;$Sub2<=$Count;$Sub1++,$Sub1++,$Sub2++,$Sub2++)
echo "$Parts[$Sub1] $Parts[Sub2]\n";
You could write this a litt
An unknown string,its format is:
y="tnk81|98.8$|yuhj78t|32.6$|tris78y|459.78$|."
list($Parts) = explode("|",$y);
$Count = count($Parts);
for($Sub1=0,$Sub2=1;$Sub2<=$Count;$Sub1++,$Sub1++,$Sub2++,$Sub2++)
echo "$Parts[$Sub1] $Parts[Sub2]\n";
Not tested.
Urb
Dr. Urban A. LeJeune, Presi
On Thursday 03 Jul 2008 12:28:26 bzcoder wrote:
> Marc Antony Vose wrote:
> > I'm checking out my code now to see if there's a difference in the
> > editions update form vs. the titles update form, but both forms run
> > through the same framework.
> >
> > Very odd...perhaps just an idiotic mistake
Marc Antony Vose wrote:
I'm checking out my code now to see if there's a difference in the
editions update form vs. the titles update form, but both forms run
through the same framework.
Very odd...perhaps just an idiotic mistake of mine somewhere.
An easy way to test would be to do a m
21 matches
Mail list logo