Anteponer ceros con PHP
/* En total deben ser 5 dígitos, los faltantes serán reemplazados por el número cero */
$numero = 10;
str_pad($numero, 5, "0", STR_PAD_LEFT);Written by Yesi D
Related protips
2 Responses
Pensar que hasta ahora lo hacia con un
$codigo = '';
$codigo = $codigo + $x;
todo eso dentro de un ciclo con varios if's anidados xD
over 1 year ago
·
Gracias por su aporte
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Related Tags
#php
Did you know?
PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#