Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #13535

Re: part two same issue - unwanted empty values in array

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: part two same issue - unwanted empty values in array
Date 2014-05-05 16:01 -0400
Organization A noiseless patient Spider
Message-ID <lk8qmt$e6i$1@dont-email.me> (permalink)
References <10ij5epc7behi$.1xza6fsoj54ve$.dlg@40tude.net> <lk8b5l$kev$1@dont-email.me> <b7qgv0zeybhr.8xbnnt41aa10.dlg@40tude.net> <lk8g8b$5it$1@dont-email.me> <lk8heg$5di$1@dont-email.me>

Show all headers | View raw


On 5/5/2014 1:23 PM, Jerry Stuckle wrote:
> On 5/5/2014 1:03 PM, Denis McMahon wrote:
>> On Mon, 05 May 2014 12:38:27 -0400, richard wrote:
>>
>>>>> As you will see, at the bottom of the list I am left with the equal
>>>>> number of unassigned array values that now contain nothing.
>>
>>> As for the code, here is what I have so far.
>>
>> You have made an error in your logic, such that $hi is greater than count
>> ($master).
>>
>> at the end:
>>
>> sort($master);
>> for ( $x = 0; $x < count($master); $x++ )
>> echo "{$x})..{$master[$x]}<br>";
>>
>
> Or, better yet:
>
> $top = count($master);
> for ( $x = 0; $x < top; $x++)
>
> That way count($master) doesn't have to be evaluated each time through
> the loop.  Minor savings, I know.  But still good programming practice,
> IMHO.
>

Correction:

$top = count($master);
for ( $x = 0; $x < $top; $x++)

I miss the '$' too, occasionally.  Been doing too much C lately...

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

part two same issue - unwanted empty values in array richard <noreply@example.com> - 2014-05-05 11:04 -0400
  Re: part two same issue - unwanted empty values in array Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 11:36 -0400
    Re: part two same issue - unwanted empty values in array "J.O. Aho" <user@example.net> - 2014-05-05 17:40 +0200
    Re: part two same issue - unwanted empty values in array richard <noreply@example.com> - 2014-05-05 12:38 -0400
      Re: part two same issue - unwanted empty values in array Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 12:51 -0400
      Re: part two same issue - unwanted empty values in array Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-05 17:03 +0000
        Re: part two same issue - unwanted empty values in array richard <noreply@example.com> - 2014-05-05 13:10 -0400
          Re: part two same issue - unwanted empty values in array Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-06 17:53 +0000
        Re: part two same issue - unwanted empty values in array Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 13:23 -0400
          Re: part two same issue - unwanted empty values in array Jerry Stuckle <jstucklex@attglobal.net> - 2014-05-05 16:01 -0400
          Re: part two same issue - unwanted empty values in array Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-06 12:33 +0000
      Re: part two same issue - unwanted empty values in array Luuk <luuk@invalid.lan> - 2014-05-06 19:49 +0200
  Re: part two same issue - unwanted empty values in array Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-05-06 00:58 +0000
    Re: part two same issue - unwanted empty values in array Evan Platt <evan@theobvious.espphotography.com.invalid> - 2014-05-06 22:31 -0700

csiph-web