Michdd Posted November 15, 2008 Share Posted November 15, 2008 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 More sharing options...
PFMaBiSmAd Posted November 15, 2008 Share Posted November 15, 2008 http://us2.php.net/manual/en/function.array-fill.php http://us2.php.net/manual/en/function.array-merge.php Link to comment https://forums.phpfreaks.com/topic/132836-variables-defining-array-contents/#findComment-690837 Share on other sites More sharing options...
Michdd Posted November 15, 2008 Author Share Posted November 15, 2008 http://us2.php.net/manual/en/function.array-fill.php http://us2.php.net/manual/en/function.array-merge.php 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? Link to comment https://forums.phpfreaks.com/topic/132836-variables-defining-array-contents/#findComment-690846 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.