Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8891843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:50:35+00:00 2026-06-14T22:50:35+00:00

So I have an array such as this: $style = array( ‘css’ => array(

  • 0

So I have an array such as this:

$style  = array(
 'css' => array(
    'name' => array('core-css', 'babababa'),
    'path' => array(get_bloginfo('stylesheet_url'), get_template_directory_uri() . '/bababa.css')
    ),
 'js' => array(
    'name' => array('core-css', 'babababa'),
    'path' => array(get_bloginfo('stylesheet_url'), get_template_directory_uri() . '/bababa.css')
    )   
);

I can walk through in this fashion:

function load_css(){
    foreach($style as $key => $value){
        var_dump($key);
    }
}

Now the var_dump will return:

string(3) "css" string(2) "js" string(3) "css" string(2) "js"

The issue is that if I do var_dump($key[‘css]) or ‘js’ I get an illegal offset error…..

I need to check for both so I assumed doing:

if(isset($key['css']) && $key['css']){}

and then

if(isset($key['js']) && $key['js']){}

But alas it doesn’t work…..

Can some one please tell me what I am doing wrong? I have walked through arrays like this countless times…. >.<

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:50:37+00:00Added an answer on June 14, 2026 at 10:50 pm

    It is proper PHP behaviour

    $a = array(
        'key' => 'value';
    );
    
    foreach ($a as  $key => $value) {
         echo $key . PHP_EOL;
         echo $value . PHP_EOL;
    }
    

    will output

    key
    value
    

    To get to name and path use:

    $value['name'];
    $value['path'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have this code inside my view. $country = array( 'id' => 'country', 'name'
Say I have an array such as: $arr[] = array(id => 11, name =>
I have an 'dictionary' array such as this: $arr['a']=5; $arr['b']=9; $arr['as']=56; $arr['gbsdfg']=89; And I
I have an array, such as this example: Array ( [0] => cinema [1]
Possible Duplicate: String with array structure to Array I have an array as such
I want to have a large 2 dimensional array such like int myArray[10000][2]; I
I have extracted a MAC address into a char* array such that each section
I have a simple question: how exactly are array variables such as $_SESSION and
I have an array of points in unknown dimensional space, such as: data=numpy.array( [[

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.