[Solved] How to remove the zeros on the left using Php [closed]


ltrim — Strip whitespace (or other characters) from the beginning of a string

You Can Use The code Below For a String or an Array:

echo ltrim("001221", '0');

$array = array("00051", "205400", "01022", "0005","000000");

foreach($array as $item) {
  $new_item = ltrim($item, '0');
  echo $new_item;
}

solved How to remove the zeros on the left using Php [closed]