note 54866 added to function.dechex

From: Date: Mon, 18 Jul 2005 13:58:00 +0000
Subject: note 54866 added to function.dechex
Groups: php.notes 
Request: Send a blank email to php-notes+get-92111@lists.php.net to get a copy of this message
simple, non-recursive way of zerofilling (why making everything complicated, there r more than enough inbuilt functions) function zfill($n,$a) { return str_repeat("0",max(0,$a-strlen($n))).$n; } "max(0,..." as multiplier inside of "str-repeat" is preventing an error with negative values, if the string length was already higher than the accuracy parameter for zfill. have fun! :) ---- Manual Page -- http://www.php.net/manual/en/function.dechex.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54866 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54866&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54866&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54866&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54866&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54866&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54866&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54866&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#92111) next »