Hi,
I need to insert a new value in middle of array.

For ex,
$arrayvariable=arrray("a","b","d");
I need to insert C in between b and d.

Thank you in advance.

Hi,
I need to insert a new value in middle of array.

For ex,
$arrayvariable=arrray("a","b","d");
I need to insert C in between b and d.

Thank you in advance.

use array_splice for that. below is the code. try it.

<?
$arrayvariable=array("a","b","d");
array_splice($arrayvariable, 2, 0, "c");
print_r ($arrayvariable);


?>

Thank U :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.