Jump to content

Variable's defining array contents.


Michdd

Recommended Posts

I need help creating something that will insert a certain number defined by a variable, of each thing into an array.

 

For example:

 

$thing1 = "5";
$thing2 = "15";

 

Then it would insert $thing1 into the array 5 times, and $thing2 15 times. In an array like this:

 

array("thing1", "thing1", "thing1", "thing1", "thing1", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2", "thing2");

Link to comment
https://forums.phpfreaks.com/topic/132836-variables-defining-array-contents/
Share on other sites

That says it outputs something like this:

 

Array
(
    [5]  => banana
    [6]  => banana
    [7]  => banana
    [8]  => banana
    [9]  => banana
    [10] => banana
)

Is that the same as what I want?

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.