<?php
class A {
public function test($tableau)
{
var_dump($tableau);
return true;
}
}
class B extends A{
public function test($tableau)
{
$limit = 5;
$res = true;
$size = count($tableau);
if( $size > $limit )
{
for ($i=0; $i < round($size/$limit) ; $i++) {
echo ($i*$limit);
$res &= parent::test(array_splice($tableau,($i*$limit),$limit));
}
}
return $res;
}
}
$ar = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o');
echo count($ar)."\n----------\n";
$b = new B();
B->test($ar);
preferences:
42.81 ms | 402 KiB | 5 Q