Jump to content

Newbie -- Add to array?


JREAM

Recommended Posts

You can tell this causes an error:

$set = array(1, 2, 3, 4);
$set = array(5, 6, 7, ;

 

So I could do

$set = array(1, 2, 3, 4);
$set2 = array(5, 6, 7, ;
$all = array_merge($set, $set2);

 

And also

$set = array(1, 2, 3, 4);
$set[] = 5;
$set[] = 6;
// etc.

 

But is there a way to do like..

$set = array(1, 2, 3, 4);
$set .= array(5, 6, 7, ; // Notice the period

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.