<?php $names = [ "Ayush" , "Vaibhav", "Shivam", "Hacker", "Topper", "ABCD", "NameR", "Tammi", "Colgate", "Britney", "Bra", "Kisser" ]; $addThis = 'ADDTHIS'; $every = 3; // how often we need to add this $count = ceil(count($names) / $every) - 1; for ($i = 0; $i < $count; $i++) { array_splice($names, $i * ($every + 1) + $every, 0, $addThis); } var_export($names);
You have javascript disabled. You will not be able to edit any code.