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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:47:43+00:00 2026-05-14T08:47:43+00:00

Was wondering if it’s possible to have a variable point to another variable in

  • 0

Was wondering if it’s possible to have a variable point to another variable in PHP? What I’m trying to do is to have a class instance like:

$users = new User_Model();

and then have

$user

simply point to

$users

instead of making a new class instance. Is this possible? Think I saw something about it in the php manual, but cant find it again.

Would

$users = new User_Model();
$user = $users;

simply do it?

Thanks

  • 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-14T08:47:44+00:00Added an answer on May 14, 2026 at 8:47 am

    By default in PHP 5 objects are copied by reference. So when you do

    $users = new User_Model();
    $user = $users;
    

    Both $user and $users point to the same object.

    However primitive types are still passed by value

    $va = 1;
    $vb = $va;
    $va = 2;
    echo $vb; //1
    

    So you need to take the reference of the primitive value;

    $va = 1;
    $vb = &$va;
    $va = 2;
    echo $vb; //2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Wondering how to open many new windows with Javascript. I have found plenty of
Wondering if anyone can help with this. I have a table with some fixed
Just wondering if anyone could help me with this. I'm new to actionscript, and
Just wondering if there is a way to select all controls/items in asp.net/c# like
was wondering if an Equivalent of PHP's stripslashes() in C existed?
was wondering how to code a server file for ajax calls ?, example: Class
Wondering if anyone has gotten the infamous database is locked error from Trac and
Wondering if there is any Text to Speech software available as a plug in
Wondering if I need to do something in my swf to be able to
Wondering if anybody out there has any success in using the JDEdwards XMLInterop functionality.

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.