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

  • Home
  • SEARCH
  • 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 8464753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:50:52+00:00 2026-06-10T14:50:52+00:00

The built-in PHP function parse_str( $str ) parses a query string and sets the

  • 0

The built-in PHP function parse_str( $str ) parses a query string and sets the variables from it into the current scope. Is there any way for me to create my own function that does something like this and returns values to the scope of the caller?

Example:

function checkset()
{
    global $inputs;
    for( $counter = 0, $varname = func_get_arg($counter), $counter++)
    {
        if(isset($inputs[$varname]))
        {
            calling_scope( $varname, $inputs[$varname] );
        }
    }
    return;
}

where calling_scope( $varname, $value) would be a function that sets $$varname in the scope where the function is called to $value. Any help is appreciated.

  • 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-10T14:50:54+00:00Added an answer on June 10, 2026 at 2:50 pm

    You can’t inject variables into the calling scope. You however can use extract to turn the keys/values from an associative array into variables in the local scope. This is probably as close as you’re going to get.

    function checkset() {
      return array('name' => 'bob', 'age' => 45);
    }
    
    extract(checkset());
    echo $name; // bob
    echo $age;  // 45
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a built-in php function or an easy way to insert an element
Is there a built-in php function, or a simple (efficient!) way to combine built-in
Is there a built-in function for PHP for me to check whether two arrays
Is there a built-in php function that converts number of seconds to military time?
Is there any built-in PHP function through which I can count the sum of
Is there a built in PHP function that will allow you get the minimum
I'm looking for the name of the PHP function to build a query string
I've built a form to upload images, and processed with Prototype/PHP. $('image_upload').observe('submit', function() {
I need to pass information via a URL to a PHP function that parses
How can i modify returning value of built-in php function without creating new function

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.