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 #183792 is a reply to message #183785] Tue, 19 November 2013 16:51 Go to previous messageGo to previous message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma:
Senior Member
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 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.
[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: Wed Nov 27 05:28:09 GMT 2024

Total time taken to generate the page: 0.07796 seconds