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

Home » Imported messages » comp.lang.php » array search part 2
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: solved [message #183793 is a reply to message #183792] Tue, 19 November 2013 17:31 Go to previous messageGo to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma:
Senior Member
richard wrote:

> On Tue, 19 Nov 2013 13:50:02 +0000, Ben Bacarisse wrote:
>
>> richard <noreply(at)example(dot)com> writes:
>>
>>> <?php
>>>
>>> $track=$_GET['item'];
>>>
>>>
>>> $asong=$six0[$track][0];
>>> $flip=$six0[$track][1];
>>>
>>> $max=count($six0);
>>>
>>> $match=0;
>>>
>>> for ($item=0;$item<=$max;$item++){
>>> if ($flip==$six0[$item]['0'])
>>> {if ($six0[$item][2]=$six0[$track][2])
>>
>> There's no need to assign something to itself just to test it. The
>> test:
>>
>
> If you'd bother to comprehend what is happening, it is not assigning
> itself.
> $item is the value derived from the loop.
> $track is the fixed valued assigned at the time of $_GET.
> so if $item and $track are equal then the statement is true

No. The _expression_ evaluates to true, if $six[0][$track][2] evaluates
to true. *Please*, note the difference between assignment and comparison.

> and the result
> assigns the value to $match and that is what is used to display the proper
> item.
>
> If $track=1 and $item=101 and the pairs match in value, then $match gets
> the number to use.

--
Christoph M. Becker
[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
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
Read Message
Read Message
Previous Topic: searching an array
Next Topic: Perform maths based on a number in a text file
Goto Forum:
  

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

Current Time: Sat Nov 30 09:55:46 GMT 2024

Total time taken to generate the page: 0.04533 seconds