note 27033 added to function.str-repeat

From: Date: Wed, 20 Nov 2002 22:26:29 +0000
Subject: note 27033 added to function.str-repeat
Groups: php.notes 
Request: Send a blank email to php-notes+get-39774@lists.php.net to get a copy of this message
While dmarsh's function is nice it duplicates the function str_pad(). str_repeat is good when you want the entire string repeated. For instance, if you want to put 6  's in somewhere, str_pad will cut it off at odd places whereas str_repeat will return 6 full &nbsp's. the following will return the same result as dmarsh's code. $t = "-=-"; print str_pad('',0,$t)."\n"; print str_pad('',1,$t)."\n"; print str_pad('',2,$t)."\n"; ...etc. -- http://www.php.net/manual/en/function.str-repeat.php http://master.php.net/manage/user-notes.php?action=edit+27033 http://master.php.net/manage/user-notes.php?action=delete+27033 http://master.php.net/manage/user-notes.php?action=reject+27033

« previous php.notes (#39774) next »