Re: I couldn't understand why PHP is so popular. The PHP code looks so horrible compared with Java.



..oO(Rik Wasmus)

Well, offcourse it's deliberately obscure.
It creates triangles based on a number:
$test.pl 1
/\
/\/\

$test.pl 2
/\
/\/\
/\ /\
/\/\/\/\

$test.pl 3
/\
/\/\
/\ /\
/\/\/\/\
/\ /\
/\/\ /\/\
/\ /\ /\ /\
/\/\/\/\/\/\/\/\

[...]

JFTR: These structures are called Sierpinski triangles and are quite
well-known fractals.

http://en.wikipedia.org/wiki/Sierpinski_triangle

Here's something similar in PHP, also quite famous:

<pre><?php $c=0;for($y=1.2;$y>-1.3;$y-=0.1){for($x=-2.08;$x<.92;$x+=.04){$r=
$n=0;for($h=127;$r*$r+$n*$n<4&&--$h>32;){$d=$r;$r=$r*$r-$n*$n+$x;$n=2*$d*$n+
$y;}($x>0.98)?print chr(10):print chr($h);if(++$c%75==0)print"\n";}}?></pre>

Micha
.