note 25725 added to ref.math

From: Date: Thu, 03 Oct 2002 09:16:07 +0000
Subject: note 25725 added to ref.math
Groups: php.notes 
Request: Send a blank email to php-notes+get-37605@lists.php.net to get a copy of this message
I _NEVER_ thought I would need to use this after leaving school, but I did... To find a triangular number (recursively) eg. tri(5) = 5 + 4 + 3 + 2 + 1 = 15 function tri($x) { if ($x == 1) return 1; else return ($x + tri($x - 1)); } -- http://www.php.net/manual/en/ref.math.php http://master.php.net/manage/user-notes.php?action=edit+25725 http://master.php.net/manage/user-notes.php?action=delete+25725 http://master.php.net/manage/user-notes.php?action=reject+25725

« previous php.notes (#37605) next »