How extract arrays from array depend on values

My array is

$arr = array(
'global' => array(
    array('tabs', 'tabs', 'tabs', array(
        'Main' => 'main',
        'Gallery' => 'galleryID',
        'mera' => 'mera',
    )),

    array('main','div',  'div'),
    array('egice', 'Eice', 'text', '', ''),
    array('closeHere', 'closeHere', 'closeHere'),


    array('galleryID','div',  'div'),
    array('gallery', 'Gallery #1', 'image', '', ''),
    array('closeHere', 'closeHere', 'closeHere'),


    array('networking', 'div', 'div'),
    array('siLype', 'SiLype', 'text', '', ''),
    array('gpXCge', 'GpXCge',  'toggle_button', '1', 'Yes', 'No', ''),
    array('closeHere', 'closeHere', 'closeHere'),


    array('mera', 'div', 'div'),
    array('maimera', 'Maimera', 'repeatedText', 'resYI', 'GYL',''),
    array('closeHere', 'closeHere', 'closeHere'),



    array( 'moures','div', 'div'),
    array('meLmo', 'MeLmo', 'text', '', ''),
    array('cYSlot', 'CYSlot', 'text', '', ''),
    array('closeHere', 'closeHere', 'closeHere'),

    array('clT', 'clT', 'clT'),



),

 );

How can I separate it to multiple array when value is “div” close the array and generate a new one .
I had tried here to do it but I can’t
https://3v4l.org/ppj1O
Could you help?

Perhaps you could show what you want to end up with, it’s not all that clear (to me at least).

Thanks, simply I want to separate the array into 4 arrays
when array has value == div begin new array to be into

$arr1 =  array(array('main','div',  'div'),
    array('egice', 'Eice', 'text', '', ''),
    array('closeHere', 'closeHere', 'closeHere'));

$arr2 = array( array('galleryID','div',  'div'),
    array('gallery', 'Gallery #1', 'image', '', ''),
    array('closeHere', 'closeHere', 'closeHere'),);

$arr3= array(    array('mera', 'div', 'div'),
    array('maimera', 'Maimera', 'repeatedText', 'resYI', 'GYL',''),
    array('closeHere', 'closeHere', 'closeHere'));

$arr4= array( array('networking', 'div', 'div'),
    array('siLype', 'SiLype', 'text', '', ''),
    array('gpXCge', 'GpXCge',  'toggle_button', '1', 'Yes', 'No', ''),
    array('closeHere', 'closeHere', 'closeHere'));

What is the real problem you are trying to solve with this code? Tell us the high level overview of what you have going on.

Simply, I want to split the main array to multiple arrays
extract new Array if “div” value found

That is not what I asked you. You are asking about your attempted solution to a problem. I want to know what the actual problem is. Your post is what is known as an XY Problem.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.