Skip to content
Advertisement

I want new array from existing array has one of old array key and value [closed]

$main_array = array( [ “XS”, “S”, “M”, “L”, “XL” ], [ “12”, “34”, “56” ], [ “Series 6/SE-44 MM”, “Series 7-45 MM” ]

);

Want result as below:

$result = array( array( “pa_clothes”=> “xs”, “pa_apple_watch”=> “44-mm”,
“test”=> “12” ), array( “pa_clothes”=> “xs”, “pa_apple_watch”=> “44-mm”,
“test”=> “34” ), array( “pa_clothes”=> “xs”, “pa_apple_watch”=> “44-mm”,
“test”=> “56” ), array( “pa_clothes”=> “xs”, “pa_apple_watch”=> “45-mm”,
“test”=> “12” ), array( “pa_clothes”=> “xs”, “pa_apple_watch”=> “45-mm”,
“test”=> “34” ), array( “pa_clothes”=> “xs”, “pa_apple_watch”=> “45-mm”,
“test”=> “56” ), array( “pa_clothes”=> “s”, “pa_apple_watch”=> “44-mm”,
“test”=> “12” ), array( “pa_clothes”=> “s”, “pa_apple_watch”=> “44-mm”,
“test”=> “34” ), array( “pa_clothes”=> “s”, “pa_apple_watch”=> “44-mm”,
“test”=> “56” ), array( “pa_clothes”=> “s”, “pa_apple_watch”=> “45-mm”,
“test”=> “12” ), array( “pa_clothes”=> “s”, “pa_apple_watch”=> “45-mm”,
“test”=> “34” ), array( “pa_clothes”=> “s”, “pa_apple_watch”=> “45-mm”,
“test”=> “56” ), array( “pa_clothes”=> “m”, “pa_apple_watch”=> “44-mm”,
“test”=> “12” ), array( “pa_clothes”=> “m”, “pa_apple_watch”=> “44-mm”,
“test”=> “34” ), array( “pa_clothes”=> “m”, “pa_apple_watch”=> “44-mm”,
“test”=> “56” ), array( “pa_clothes”=> “m”, “pa_apple_watch”=> “45-mm”,
“test”=> “12” ), array( “pa_clothes”=> “m”, “pa_apple_watch”=> “45-mm”,
“test”=> “34” ), array( “pa_clothes”=> “m”, “pa_apple_watch”=> “45-mm”,
“test”=> “56” ), array( “pa_clothes”=> “l”, “pa_apple_watch”=> “44-mm”,
“test”=> “12” ), array( “pa_clothes”=> “l”, “pa_apple_watch”=> “44-mm”,
“test”=> “34” ), array( “pa_clothes”=> “l”, “pa_apple_watch”=> “44-mm”,
“test”=> “56” ), array( “pa_clothes”=> “l”, “pa_apple_watch”=> “45-mm”,
“test”=> “12” ), array( “pa_clothes”=> “l”, “pa_apple_watch”=> “45-mm”,
“test”=> “34” ), array( “pa_clothes”=> “l”, “pa_apple_watch”=> “45-mm”,
“test”=> “56” ), array( “pa_clothes”=> “xl”, “pa_apple_watch”=> “44-mm”,
“test”=> “12” ), array( “pa_clothes”=> “xl”, “pa_apple_watch”=> “44-mm”,
“test”=> “34” ), array( “pa_clothes”=> “xl”, “pa_apple_watch”=> “44-mm”,
“test”=> “56” ), array( “pa_clothes”=> “xl”, “pa_apple_watch”=> “45-mm”,
“test”=> “12” ), array( “pa_clothes”=> “xl”, “pa_apple_watch”=> “45-mm”,
“test”=> “34” ), array( “pa_clothes”=> “xl”, “pa_apple_watch”=> “45-mm”,
“test”=> “56” ) );

Advertisement

Answer

As per my understanding you required

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement