Answers for "array of zero php"

PHP
1

add zeros in front of number php

<?php
$num = 4;
$num_padded = sprintf("%02d", $num);
echo $num_padded; // returns 04
?>
Posted by: Guest on April-25-2020
0

fill zero on php

$number = 12;
$width = 4;
$padded = str_pad((string)$number, $width, "0", STR_PAD_LEFT);
Posted by: Guest on September-03-2021

Browse Popular Code Answers by Language