Skip to content

Instantly share code, notes, and snippets.

@Merazsohel
Created September 7, 2021 06:40
Show Gist options
  • Save Merazsohel/23316c1f04f549888309cea0dde40103 to your computer and use it in GitHub Desktop.
Save Merazsohel/23316c1f04f549888309cea0dde40103 to your computer and use it in GitHub Desktop.
Serially bulk barcode generate
$barcodes = [];
$from = explode("-", $request->input("from"));
$to = explode("-", $request->input("to"));
$totalDigit = strlen($from[1]);
$startFrom = (int) $from[1];
$endTo = (int) $to[1];
for ($i = $startFrom; $i <= $endTo; $i++) {
$barcode = $from[0] . "-" . str_pad($i, $totalDigit, "0", STR_PAD_LEFT);
array_push($barcodes, $barcode);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment