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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:28:50+00:00 2026-05-25T12:28:50+00:00

When I use print_r to examine the contents of this function $arr and $refs

  • 0

When I use print_r to examine the contents of this function $arr and $refs are the same.

Odd because this was a solution given here to the problems of passing call_user_func_array an array of references.

Does this function return an array of references or an array of values?

function makeValuesReferenced($arr){ 
    $refs = array(); 
    foreach($arr as $key => $value) 
        $refs[$key] = &$arr[$key]; 
    return $refs; 

}

Function Call:

print_r($db_->ref_arr(array(1,2,3,4)));

Results

Array ( [0] => 1 
        [1] => 2 
        [2] => 3 
        [3] => 4 )

Info. on prepared statements here

Info. on call_user_func_array here

Info. on the neccessity of references for call_user_func_array here

Does this function return an array of references or an array of values?

Update: using var_dump and adding & to parameter gives similar results…adds verification that ints are being returned.

1 2 3 4 array(4) { [0]=> &int(1) 1=> &int(2) 2=> &int(3) 3=>
&int(4) }

  • 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-05-25T12:28:51+00:00Added an answer on May 25, 2026 at 12:28 pm

    No, your function does not return an array of references.
    If you want to return an array of references, change to:

    function makeValuesReferenced(&$arr){ 
        $refs = array(); 
        foreach($arr as $key => $value) 
            $refs[$key] = &$arr[$key]; 
        return $refs; 
    
    }
    

    PS: You should use var_dump to check.

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

Sidebar

Related Questions

I have a multidimensional array that when i use print_r looks like this: Array
I use this in my script: $xml = file_get_contents('gapi.account.php'); print_r($xml); Easy, right? But now...
In following php code in here //print_r($reunits); is output this: http://pastebin.com/RbqZ5kHV but in here
I have an array called $results, when I use function: print_r($results); I get the
I try to use amazon API using PHP. If I use print_r($parsed_xml->Items->Item->ItemAttributes) it show
I use iTextSharp to print a grid view but I face some problems: No
I have a set of data that looks like this when using print_r($var) :
What function can I use in PHP for class Smarty which reads a variable's
I have an url return an XML page result. When I use this command:
I'm figuring this problem: I have the $_POST['user'] variable. If I print_r this variable

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.