3 * proto array array_splice(array input, int offset [, int length [, array replacement]])
4 * Function is implemented in ext/standard/array.c
7 function test_splice ($offset, $length)
9 echo " - No replacement\n";
10 $input_array=array(0,1,2,3,4,5);
11 var_dump (array_splice (&$input_array,$offset,$length));
12 var_dump ($input_array);
13 echo " - With replacement\n";
14 $input_array=array(0,1,2,3,4,5);
15 var_dump (array_splice (&$input_array,$offset,$length,array ("A","B","C")));
16 var_dump ($input_array);
18 <<__EntryPoint
>> function main(): void
{
19 echo "*** array_splice() function : usage variations - lengths and offsets\n";
21 echo "absolute offset - absolute length - cut from beginning\n";
23 echo "absolute offset - absolute length - cut from middle\n";
25 echo "absolute offset - absolute length - cut from end\n";
27 echo "absolute offset - absolute length - attempt to cut past end\n";
29 echo "absolute offset - absolute length - cut everything\n";
31 echo "absolute offset - absolute length - cut nothing\n";
34 echo "absolute offset - relative length - cut from beginning\n";
37 echo "absolute offset - relative length - cut from middle\n";
40 echo "absolute offset - relative length - attempt to cut form before beginning \n";
43 echo "absolute offset - relative length - cut nothing\n";
46 echo "relative offset - absolute length - cut from beginning\n";
49 echo "relative offset - absolute length - cut from middle\n";
51 echo "relative offset - absolute length - cut from end\n";
53 echo "relative offset - absolute length - attempt to cut past end\n";
55 echo "relative offset - absolute length - cut everything\n";
57 echo "relative offset - absolute length - cut nothing\n";
60 echo "relative offset - relative length - cut from beginning\n";
63 echo "relative offset - relative length - cut from middle\n";
66 echo "relative offset - relative length - cut nothing\n";