0

If I have large set of data in an array from like this,

1 => A 2 => B .... etc

How can I add a set of data to the end of the array using PHP? For example if there are 26 elements

26 => Z

How can I add 27 =>AA at the end of the array using PHP? We can get the number of elements using count, but because the large amount of data can't use arrary_push to add the new data at the end. Any help? Thanks.

1
  • When you say large amount of data, how many elements are you talking about? A-Z is only 26, and adding AA means 27... that's nnot large Commented Sep 24, 2012 at 21:32

2 Answers 2

3

quite simple:

$myArray = array('A','B', 'C');

$myArray[] = 'D';
Sign up to request clarification or add additional context in comments.

Comments

0

Take advantage of PHP's Perl-style character incrementor

$data = range('A','Z');
$last = end($data);
$last++;
$data[] = $last;

var_dump($data);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.