array_insert_after( array $array, string $key, array $new )
Insert a value or key/value pair after a specific key in an array. If key doesn’t exist, value is appended to the end of the array.
Description
Parameters
- $array
-
(Required)
- $key
-
(Required)
- $new
-
(Required)
Return
(array)
Source
File: bp-core/admin/bp-core-admin-slugs.php
function array_insert_after( array $array, $key, array $new ) { $keys = array_keys( $array ); $index = array_search( $key, $keys ); $pos = false === $index ? count( $array ) : $index + 1; return array_merge( array_slice( $array, 0, $pos ), $new, array_slice( $array, $pos ) ); }
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.