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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:58:06+00:00 2026-06-04T09:58:06+00:00

Is there is simple and quick way to convert php array from $actions =

  • 0

Is there is simple and quick way to convert php array from

 $actions =  Array ( [visits-visit] => Array ( 
                                  [0] => index 
                                  [1] => edit 
                                  [2] => add 
                                  [3] => delete 
                                  [4] => search 
                                ) 
       ) 

to

Array ( [visits-visit] => Array ( index ,edit ,add ,delete, search ) ) 

I have an array in the first format, and need to add it as this

 $this->allow($_userRole, 'module-contr', array( index ,edit ,add ,delete, search));

when I make like this

$this->allow($_userRole, 'module-contr', array( $actions ));

it’s not accepted as I want.

  • 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-04T09:58:07+00:00Added an answer on June 4, 2026 at 9:58 am

    Those two arrays are essentially the same… The first array is simply how it will be displayed should you decide to print it out (with print_r() for example). When you are defining an array IE. creating an array with values already inside it, you would write something like this –

    $someArr = array(
      'index_of_another_array' => Array ( 'index' ,'edit' ,'add' ,'delete', 'search' )
    ); 
    

    Essentially the array you are creating already has the numerical indexes implied by the order of their appearance… The element at index [0] is the string index. At index [1] you have the string edit… At index [2] you have add… and so on…

    Another thing to note is this line that you stated –

    $this->allow($_userRole, 'module-contr', array( $actions ));
    

    With the last parameter, what you are essentially doing is passing the $actions within an additional array! What you are doing is creating a new array with the first element equal to $actions. I think you should remove that additional array by simply passing $actions and not array( $actions )

    I hope this cleared things up a little bit…

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

Sidebar

Related Questions

Is there a simple way to convert data in a dataframe from fraction to
Is there a quick and simple way to check if a key exists in
Is there a simple way to work with C++ objects directly from C? I
Is there a simple way to convert MP3 to WAV in vb2005? what i
Is there a simple way or method to convert a Stream into a byte[]
just a quick question. Is there a SIMPLE way to dynamic set the cell
Is there a simple and quick way to use sum() with non-integer values? So
I am wondering if there is a quick simple way to check whether a
I'm wondering if there is a simple and quick way of displaying an image
Is there a simple way to see assigned shortcuts with given prefix? Something similar

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.