How to remove zero before number in PHP?

Member

dalton_moen

by dalton_moen, in category: PHP General , 4 months ago

How to remove zero before number in PHP?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by darion , 3 months ago

@dalton_moen you can cast it to integer to remove zero before any number in PHP, code:


1
2
3
4
5
6
<?php

$num = '025';

// Output: 25
echo (int) $num;