PHP Array Push Key Value Example

PHP Array Push Key Value Example

Hello friends, Today we will show PHP array push key value. In this example we will learn php array push key value pair. we will explain step by step example of php push key and value in array.

Here, we will show how to push both value and key in php, php push function is used to push both value and key in array, how to use array_push() function in php.

Syntax

array_push(array, value1, value2, ...);
Example
<?php
    $a=array("a"=>"red","b"=>"green");
    array_push($a,"blue","yellow");
    print_r($a);
?>

I hope you understand of php push array key and value and it can help you…

Read Also :  PHP Array Functions With Examples