Skip to main content
Post Undeleted by Expedito
deleted 124 characters in body
Source Link
Expedito
  • 7.8k
  • 5
  • 32
  • 45

Maybe you're trying to do something like this:

$out = array();
foreach ($url as $key => $value){
    $dex = key($value);
    $out[$dex][] = $value[$dex];reset($value[$dex]);
}
print_r($out);

If you get rid of the extra space after you key "youtube " (the first one has an extra space), you'll get the following output:

Array
(
    [youtube] => Array
        (
            [0] => Array
                (
                    [youtube.com] => https://www.youtube.com/dfssfskj8i
                )

            [1] => Array
                (
                    [youtube.com] => https://www.youtube.com/sfsfsd
                )

        )

)

Maybe you're trying to do something like this:

$out = array();
foreach ($url as $key => $value){
    $dex = key($value);
    $out[$dex][] = $value[$dex];
}
print_r($out);

If you get rid of the extra space after you key "youtube " (the first one has an extra space), you'll get the following output:

Array
(
    [youtube] => Array
        (
            [0] => Array
                (
                    [youtube.com] => https://www.youtube.com/dfssfskj8i
                )

            [1] => Array
                (
                    [youtube.com] => https://www.youtube.com/sfsfsd
                )

        )

)

Maybe you're trying to do something like this:

$out = array();
foreach ($url as $key => $value){
    $dex = key($value);
    $out[$dex][] = reset($value[$dex]);
}
print_r($out);

If you get rid of the extra space after you key "youtube ", you'll get the following output:

Array
(
    [youtube] => Array
        (
            [0] => https://www.youtube.com/dfssfskj8i
            [1] => https://www.youtube.com/sfsfsd
        )

)
Post Deleted by Expedito
Post Undeleted by Expedito
Post Deleted by Expedito
Source Link
Expedito
  • 7.8k
  • 5
  • 32
  • 45

Maybe you're trying to do something like this:

$out = array();
foreach ($url as $key => $value){
    $dex = key($value);
    $out[$dex][] = $value[$dex];
}
print_r($out);

If you get rid of the extra space after you key "youtube " (the first one has an extra space), you'll get the following output:

Array
(
    [youtube] => Array
        (
            [0] => Array
                (
                    [youtube.com] => https://www.youtube.com/dfssfskj8i
                )

            [1] => Array
                (
                    [youtube.com] => https://www.youtube.com/sfsfsd
                )

        )

)