Jump to content

Alternative to array_push


TheJoey

Recommended Posts

Try doing this:

 

// initialize the array
$newArray = array();
// set some values in variables
$tick = 1;
$tock = 2;
// stick em in the array
$newArray[] = $tick;
$newArray[] = $tock;

this will create the following aray

$newArray(1, 2);

 

thats about it. I would use array_push() though -> you can do alot more like pushing arrays into arrays... etc. Check php.net for more info on it

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.