php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75827 Variables with space, how is it possible?
Submitted: 2018-01-17 01:54 UTC Modified: 2018-01-17 04:19 UTC
From: vini_000 at live dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vini_000 at live dot com
New email:
PHP Version: OS:

 

 [2018-01-17 01:54 UTC] vini_000 at live dot com
Description:
------------
You can create variables with the name entered in another variable. But if the name has space, how can you reference it?

Test script:
---------------
$test = "testing test";
$$test = "5";
echo $$test; // result: 5
echo $testing test //this can not

/*Now with a variable with no space*/

$test = "testing";
$$test = "5";
echo $testing; //result:5
echo $$test; //result:5

/*How can I reference a variable as an example (testing test)?*/



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-17 03:20 UTC] spam2 at rhsoft dot net
thisis a *bugtracker* and not https://stackoverflow.com/

however:
$test = "testing test";
$$test = "5";
echo $$test;
echo "${'testing test'}";
 [2018-01-17 04:19 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-01-17 04:19 UTC] requinix@php.net
Protip: don't do weird things with variable variables.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 15:01:33 2025 UTC