# Fill the rest with zeroes. PHP

**URL:** https://forum.kirupa.com/t/fill-the-rest-with-zeroes-php/152295
**Category:** Uncategorized
**Created:** [June 22, 2005, 6:25pm UTC](https://forum.kirupa.com/t/fill-the-rest-with-zeroes-php/152295 "2005-06-22T18:25:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![imagined](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@imagined](https://forum.kirupa.com/u/imagined)
#### Post date: [June 22, 2005, 6:25pm UTC](https://forum.kirupa.com/t/fill-the-rest-with-zeroes-php/152295/1 "2005-06-22T18:25:39Z")

</div>

Let’s say a have a variable with value 9 and another one with value 384. If I want the variable to be 5 digits long. How would I automatically fill the rest with zeroes to the left. Just like this:

$var = 9;  
$anotherVar = 384;

I want them to have this value:

$var = 00009;  
$anotherVar = 00384;

Thanks,  
Leo
