Moron Posted January 13, 2009 Share Posted January 13, 2009 How do I do this? I don't want to PRINTF() something right here and now, but I want to format it so I can use substr() on it later. $endingdate = printf ("%08d", $RESULT['PSTUB5']); I want to zero-fill this field to make it eight characters (if the date is 1152009, I want it to be 01152009, etc...) Link to comment https://forums.phpfreaks.com/topic/140689-solved-function-printf/ Share on other sites More sharing options...
kenrbnsn Posted January 13, 2009 Share Posted January 13, 2009 Use sprintf <?php $endingdate = sprintf ("%08d", $RESULT['PSTUB5']); ?> Ken Link to comment https://forums.phpfreaks.com/topic/140689-solved-function-printf/#findComment-736324 Share on other sites More sharing options...
Moron Posted January 13, 2009 Author Share Posted January 13, 2009 Use sprintf <?php $endingdate = sprintf ("%08d", $RESULT['PSTUB5']); ?> Ken You're a lifesaver. Thanks a ton! Link to comment https://forums.phpfreaks.com/topic/140689-solved-function-printf/#findComment-736329 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.