I am trying to create a function with will do the following: There is an array built in the form of
$array = [
0 => 1,
1 => 2,
2 => 4,
];
i want to create a string in the length of 5, in which the values of the current array in the correct order, like: 12040.
or
$array = [
0 => 3,
1 => 5,
];
will become: 00305
essentially, replacing the places that don't exist in the array with 0 in the string.
thank you!
[1,2,4]become1204and[3,5]->00305? I don't see the pattern behind it0s are where the value does not exist - ie.[1,2,4]is missing the3,5, so they want to do[1,2,0,4,0]or12040, and[0,0,3,0,5]/00305since the1,2,4are not set