PHP array_push without numeric key

前端 未结 3 1897
情深已故
情深已故 2020-12-17 22:40

how do i push new array without numeric key?

$array = array(\'connect\' => array(\'mydomain.com\' => 1.99) );
$new_array[\'mynewdomain.com\'] = 2.99;

         


        
3条回答
  •  醉话见心
    2020-12-17 23:05

    Simply append element to the array.

    $array['connect']['mynewdomain.com'] = 2.99;
    

    No need to do array_push(). Just use PHP's in built constructs to get the job done.

    In Built language constructs are more faster than in built functions and custom functions.

提交回复
热议问题