3 ms·
I don't… I don't see much difference. ~$ python >>> A = "<?php for($i = 0; $i < $len; $i++) { ?><p>Foo <?echo $i?></p><? } ?>" >>> B = "<? foreach(
by godDLL 14y ago
I don't… I don't see much difference.
~$ python
>>> A = "<?php for($i = 0; $i < $len; $i++) { ?><p>Foo <?echo $i?></p><? } ?>"
>>> B = "<? foreach($foo as $i): ?> <p>Foo <?= $i ?> </p> <? endforeach ?>"
>>> L = [A,B]; import re
>>> map(len, L)
[68, 65]
>>> map(lambda x: len([s for s in x if re.match('\w', s)]), L)
[23, 29]
Isn't it about the same amount of alphanum vs noise? About the same length too.
I'm not sure B is more readable than A in any way. Maybe more 'idiomatic', meaning 'way humans think'; but I'm not sure about that.
- chc 14y agoB is just a bit more cleanly organized. Somewhat like the difference between code that uses sensible indentation and code that uses deceptive indentation — they both look statistically similar, but the organization helps us read it.