How can I dynamically split and load characters between many spatial characters to new string variable?
I am getting a variable from client side which always contains 5 - characters but the digits between them can be in different size and looks like 00000-0000-000-00-0000-00 now I need to load each part to new variable $p1 to $p5
$barcode = "00000-0000-000-00-0000-00";
// $p1 = "00000";
// $p2 = "0000";
// $p3 = "000";
// $p4 = "0000";
// $p5 = "00";