FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » part two same issue - unwanted empty values in array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: part two same issue - unwanted empty values in array [message #185750 is a reply to message #185748] Mon, 05 May 2014 20:01 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
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(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to join two arrays?
Next Topic: The goto statement in PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 06:41:48 GMT 2024

Total time taken to generate the page: 0.04532 seconds