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 replace by <br 
Php :: laravel migration add column to existing table 
Php :: string first letter uppercase php 
Php :: how to get ip address of client using php 
Php :: laravel return back with success 
Php :: composer laravel ui 
Php :: how to get page name in php 
Php :: how to migrate single table in laravel 
Php :: php get last modified date of file 
Php :: Call to undefined method JeroenNotenLaravelAdminLteHelpersMenuItemHelper::isSearchBar( 
Php :: laravel passport generate key 
Php :: laravel failed jobs retry 
Php :: php file_get_contents follow redirect 
Php :: php remove extension from url 
Php :: get the string after a character in php 
Php :: zsh: command not found: laravel 
Php :: php get type of object 
Php :: homebrew install php 7.4 
Php :: how uninstall the laravel 
Php :: php header pdf open in browser 
Php :: php document root 
Php :: php iterate folder 
Php :: composer error installation 
Php :: Sorry, This File Type Is Not Permitted for Security Reasons 
Php :: select distinct laravel 
Php :: category name wp query 
Php :: laravel publish email template 
Php :: Add 2 days to the current date in PHP 
Php :: complete url php 
Php :: laravel storage folder permissions 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =