Jump to content

[SOLVED] Accumulative repetition


448191

Recommended Posts

As soon as you posted that, I realized I what I meant to say is I need exponential growth of repetition, not accumulative. So thanks for being confused  ;D

 

<?php
$array = array();
$base = 2;
$fill = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h');
for($i = 1; $i < count($fill); ++$i){
$array = array_merge($array, array_fill(0, pow($base, $i), current($fill)));
next($fill);
}
var_dump($array);
?>

 

I feel a bit stupid for not thinking of this right away. Anyway. Thanks for reading  :P

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.