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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 05:01:30 2024 UTC