Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php 0 padding left


<?php
$input = "Alien";
echo str_pad($input, 10);                      // produces "Alien     "
echo str_pad($input, 10, "-=", STR_PAD_LEFT);  // produces "-=-=-Alien"
echo str_pad($input, 10, "_", STR_PAD_BOTH);   // produces "__Alien___"
echo str_pad($input,  6, "___");               // produces "Alien_"
echo str_pad($input,  3, "*");                 // produces "Alien"
?>

Comment

padding number in php

$number = 12;
$width = 4;
$padded = str_pad((string)$number, $width, "0", STR_PAD_LEFT); 
Comment

PREVIOUS NEXT
Code Example
Php :: php two decimal places 
Php :: get current route in blade laravel 
Php :: getclientoriginalextension laravel 
Php :: require all files in directory php 
Php :: wp get acf category in post 
Php :: update eloquent with increment laravel 
Php :: Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in 
Php :: how to create a logout button in wordpress 
Php :: laravel migration remove unique 
Php :: case inside laravel query 
Php :: Array Contant PHP 
Php :: change date format php 
Php :: Could not find package laravel/ with stability stable. 
Php :: php increment letter 
Php :: get_transient wordpress 
Php :: sort multidimensional array php by key 
Php :: wp get author description 
Php :: how to show validation error in laravel 8 
Php :: upload_max_filesize 
Php :: php create url with query sting from array 
Php :: Failed to authenticate on SMTP server with username 
Php :: how to get n days from today in php 
Php :: laravel api form request validation 404 
Php :: logout in php 
Php :: php curl example 
Php :: how to get current url in laravel 
Php :: php generate slug 
Php :: laravel http retry 
Php :: php copy 
Php :: Laravel Password & Password_Confirmation Validation 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =