PHP bir dizi diğer ikisi ile yerine bir öğe değiştirin

0 Cevap php

Özet: bir dizi göz önüne alındığında

{a, b, ..., w, x, ..., z}

Ayrıca kaldırma {m, n, ..., r} x pozisyonunda çeşitli elemanları, x yerleştirin. Final dizi:

{a, b, ..., w, m, n, ..., r, ..., z}

Bir geri dönüş dizi var

$return_arr = array(
                    'saa'=>'A2223',
                    'asab'=>'asB',
                    'wqed'=>'D234',
                    'wqasee'=>'Esd',
                    'wqewf'=>'Ffds',
                    'monwa'=>'monwaaas'//*
                    );

it will return new array if in this array exist this element 'monwa'=>'monwaaas'.And the new array will be the next order of element that we found for example
if we have $return_arr =>the new_array should be

(add two more element ('hi'=>'HI','hello'=>'HELLO')

$new_array = array(
                    'saa'=>'A2223',
                    'asab'=>'asB',
                    'wqed'=>'D234',
                    'wqasee'=>'Esd',
                    'wqewf'=>'Ffds',
                    'hi'=>'HI',
                    'hello'=>'HELLO'
                    );

Ve eğer

$return_arr = array(
                    'saa'=>'A2223',
                    'asab'=>'asB',
                    'monwa'=>'monwaaas',//*
                    'wqed'=>'D234',
                    'wqasee'=>'Esd',
                    'wqewf'=>'Ffds'
                    );

new_array olmalıdır:

$new_array = array(
                    'saa'=>'A2223',
                    'asab'=>'asB',
                    'hi'=>'HI',
                    'hello'=>'HELLO',
                    'wqed'=>'D234',
                    'wqasee'=>'Esd',
                    'wqewf'=>'Ffds'
                    );

Ve böylece On ...

Herkes bunu nasıl bilir?

teşekkürler

0 Cevap