I have an array:
$names = [
"Ayush" , "Vaibhav", "Shivam",
"Hacker", "Topper", "ABCD",
"NameR", "Tammi", "Colgate",
"Britney", "Bra", "Kisser"
];
And I have another variable
$addthis = "ADDTHIS";
How to make an array from these two so that after every three items in $names, the value of $addthis is added. So, I want this array as result from these two.
$result = [
"Ayush", "Vaibhav", "Shivam", "ADDTHIS",
"Hacker", "Topper", "ABCD", "ADDTHIS",
"NameR", "Tammi", "Colgate", "ADDTHIS",
"Britney", "Bra", "Kisser"
];
“Oneliner”, just for fun: