Insert element in the middle of array

/ Published in: PHP
Save to your folder(s)

Instead of one element you can insert multiple at once:
array($element1, $element2, $element3)

Copy this code and paste it in your HTML
  1. array_splice($array, floor(count($array)/2), 0, $element);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.