Search
 
SCRIPT & CODE EXAMPLE
 

PHP

add leading zeros in php

$number = 4;
echo(str_pad($number, 2, '0', STR_PAD_LEFT)); // returns 04

$number = 14;
echo(str_pad($number, 2, '0', STR_PAD_LEFT)); // returns 14
Comment

format a number with leading zeros in php

sprintf('%06d', '12')
Comment

PREVIOUS NEXT
Code Example
Php :: how to clear session in laravel 
Php :: php set environment variable 
Php :: Instalar Lamp server en Ubuntu 
Php :: file form validation codeigniter 
Php :: check if string contains only whitespace php 
Php :: woocommerce phone number not required 
Php :: transient wordpress 
Php :: php fetch mysql result as variable 
Php :: Call to a member function move() on string 
Php :: stdclass not found laravel 
Php :: laravel break 
Php :: check installed php modules in linux 
Php :: php get data from url 
Php :: php concatenate string 
Php :: reset password symfony 
Php :: laravel model events 
Php :: hide add new link on cpt page 
Php :: phpmyadmin add foreign key 
Php :: laravel soft delete example 
Php :: how to add page link in laravel 
Php :: laravel loop index 
Php :: implode example in php 
Php :: laravel fetch max value 
Php :: how to use seeders in laravel 
Php :: php description limit 
Php :: php timezone change 
Php :: laravel collection max 
Php :: test post request laravel 
Php :: Custom Font Laravel 
Php :: composer create new laravel project 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =