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


Groups > comp.lang.php > #11879

Re: solved

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.php
Subject Re: solved
Date Wed, 20 Nov 2013 16:02:49 +0100
Lines 89
Message-ID <528CCF19.6000204@arnowelzel.de> (permalink)
References <93xuovoqvo59.1wcgm8i5gn2hb$.dlg@40tude.net> <1939vbqgxpb1.1ed40enyqnzu1$.dlg@40tude.net> <528B952D.9090500@arnowelzel.de> <e0zdmv9q27si.s1q3n4mv1gr4.dlg@40tude.net>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Trace individual.net YdE+EcpTNmUukDNUCa5sBQrDnAyCrTRmYC0NJTswdgBiR0qo26
Cancel-Lock sha1:8kfO0m/chpDn5iwwn+NpegsTTYc=
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
In-Reply-To <e0zdmv9q27si.s1q3n4mv1gr4.dlg@40tude.net>
Xref csiph.com comp.lang.php:11879

Show key headers only | View raw


Am 19.11.2013 20:41, schrieb richard:
> On Tue, 19 Nov 2013 17:43:25 +0100, Arno Welzel wrote:
> 
>> Am 19.11.2013 03:45, schrieb richard:
>>> <?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])
>>>    {$match=$item;}}
>>> }
>>
>> PLEASE format your code properly!
>>
>> for($item=0; $item <= $max; $item++)
>> {
>>   if($flip == $six0[$item]['0'])
>>   {
>>     if($six0[$item][2] = $six0[$track][2])
>>     {
>>       $match = $item;
>>     }
>>   }
>> }
>>
>> And why this?
>>
>> if($six0[$item][2] = $six0[$track][2])
>>
>> Please note: "=" is NOT the same as "=="!
>>
>> If you want to COMPARE $six0[$item][2] and $six0[$track][2] you MUST write:
>>
>> if($six0[$item][2] == $six0[$track][2])
> 
> The script works if it were on one line or 100 lines.

READ what I wrote. I said nothing about the question, if your code works
or not - but I doubt, that you really *know* what the difference is between:

if($six0[$item][2] = $six0[$track][2])

and

if($six0[$item][2] == $six0[$track][2])

Do you? Can you explain, why your code uses the assignement and not the
comparison?

Some how it feels if I already explained this a dozen times and I just
forgot that...

> You've never seen a page where the source code was 10,000 characters long
> all on one single line?

I did. And you don't see any difference in readability above in your
version and my formatted version?

Also see here:

<http://arnowelzel.de/wiki/lib/exe/js.php>

But this does not mean, that such code is *readable* nor that I
recommend to write code this way.

In this special case (<http://arnowelzel.de/wiki/lib/exe/js.php>)  it is
a "compressed" JavaScript to save bandwidth and lower the number of HTTP
requests needed. But this is constructed dynamically by js.php which
takes the local JavaScript files and creates a big "compressed" version
of them in one single block.

But for scripts which remains on the server and will never be
transmitted to the client it should be *readable* for *humans*.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

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


Thread

array search part 2 richard <noreply@example.com> - 2013-11-18 09:10 -0500
  Re: array search part 2 Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-18 15:32 +0100
    Re: array search part 2 richard <noreply@example.com> - 2013-11-18 09:59 -0500
  Re: array search part 2 richard <noreply@example.com> - 2013-11-18 09:31 -0500
  Re: array search part 2 Tim Streater <timstreater@greenbee.net> - 2013-11-18 15:05 +0000
    Re: array search part 2 richard <noreply@example.com> - 2013-11-18 11:06 -0500
      Re: array search part 2 Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-18 17:17 +0100
      Re: array search part 2 "Peter H. Coffin" <hellsop@ninehells.com> - 2013-11-18 11:08 -0600
      Re: array search part 2 Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-11-19 03:11 +0000
      Re: array search part 2 Arno Welzel <usenet@arnowelzel.de> - 2013-11-19 09:27 +0100
    Re: array search part 2 Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-18 13:08 -0500
  Re: array search part 2 richard <noreply@example.com> - 2013-11-18 11:11 -0500
    Re: array search part 2 "J.O. Aho" <user@example.net> - 2013-11-18 19:10 +0100
      Re: array search part 2 Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-18 18:28 +0000
        Re: array search part 2 "J.O. Aho" <user@example.net> - 2013-11-18 20:03 +0100
  solved  (was: array search part 2) richard <noreply@example.com> - 2013-11-18 21:45 -0500
    Re: solved Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-19 13:50 +0000
      Re: solved Scott Johnson <noonehome@chalupasworld.com> - 2013-11-19 06:16 -0800
        Re: solved Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-19 16:29 +0000
          Re: solved Scott Johnson <noonehome@chalupasworld.com> - 2013-11-19 10:57 -0800
      Re: solved tony@mountifield.org (Tony Mountifield) - 2013-11-19 14:48 +0000
        Re: solved Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-19 16:12 +0100
        Re: solved Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-19 16:25 +0000
      Re: solved richard <noreply@example.com> - 2013-11-19 11:51 -0500
        Re: solved Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-19 18:31 +0100
        Re: solved Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-19 18:15 +0000
    Re: solved Arno Welzel <usenet@arnowelzel.de> - 2013-11-19 17:43 +0100
      Re: solved richard <noreply@example.com> - 2013-11-19 14:41 -0500
        Re: solved "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2013-11-19 19:52 +0000
        Re: solved Arno Welzel <usenet@arnowelzel.de> - 2013-11-20 16:02 +0100

csiph-web