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 8118335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:27:21+00:00 2026-06-06T04:27:21+00:00

PHP: I have made up a function that returns an array. I would like

  • 0

PHP:

I have made up a function that returns an array. I would like to be able to echo only one part of this array without having to make a variable like this:

$var = meth_0('getPlayerLimit');
echo $var['success'];

Is this possible? I´ve already tested doing what’s bellow and it didn´t work.

echo meth_0('getPlayerLimit')['success'];

Thanks for your time 🙂

  • 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-06T04:27:23+00:00Added an answer on June 6, 2026 at 4:27 am

    You can do it with PHP 5.4, it is called array dereferencing:

      function get_cars()
      {
        return ["ferrari","lamborghini","maserati","bugatti"];
      }
      echo get_cars()[3];  //bugatti
    

    example taken at http://www.waynemay.com/function-array-dereferencing-in-php-5-4-03052012

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a php page that sends an email message with multiple attachments.
i have made a simple php contact form following this tutorial: http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme The big
I have made a form that accepts query and executes it through php. I
Is there a PHP function that will do the following: Move a specified array
I have two models that I would like to present in a single Yii
I have made a string generator: <?php function createRandomPassword() { $chars = abcdefghijkmnopqrstuvwxyz023456789; srand((double)microtime()*1000000);
I have a PHP web application where I've made a little module system, that
I am new to ZF.i have made a function that basically make a Form
I have made a site with classic php and mysql functions. I order to
I have made a game which is nearly identical to Popcap's Atomica. ( http://www.popcap.com/gamepopup.php?theGame=atomica

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.