Jump to content

Recommended Posts

Hi I'm trying to make an array contains the a-z follow by a number in 8 digits but it has to be repeated
before the 4 digit.

something like this, 

a00010001 
a00020002
a00030003
a00040004
a00050005
to 
a10001000

and when it ends go to the next caracter

b00010001
b00020002
to 
b10001000

hope can you give me an idea, Thanks !!

Link to comment
https://forums.phpfreaks.com/topic/279572-array/
Share on other sites


$myArray = array();
foreach (range("a","z") as $letter) {
 
   $x=1;
   while ($x<1001) {
      $myArray[] = $letter.str_pad($x,4,"0",STR_PAD_LEFT).str_pad($x,4,"0",STR_PAD_LEFT);
      $x++;
   }
}
Edited by dalecosp
Link to comment
https://forums.phpfreaks.com/topic/279572-array/#findComment-1437869
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.