Odd Custom PHP Variables

By  on  

Creating custom-named PHP variables is pretty easy:

${'username'} = 'User1010'; // same as $username = 'User1010';

But did you know that you can create variables with spaces? The following will work:

${'name of user'} = 'David Walsh';
echo ${'name of user'};

I can't see any reason to do this, but it's possible.

Recent Features

  • By
    CSS Animations Between Media Queries

    CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...

  • By
    How to Create a RetroPie on Raspberry Pi – Graphical Guide

    Today we get to play amazing games on our super powered game consoles, PCs, VR headsets, and even mobile devices.  While I enjoy playing new games these days, I do long for the retro gaming systems I had when I was a kid: the original Nintendo...

Incredible Demos

  • By
    Image Reflections with CSS

    Image reflection is a great way to subtly spice up an image.  The first method of creating these reflections was baking them right into the images themselves.  Within the past few years, we've introduced JavaScript strategies and CANVAS alternatives to achieve image reflections without...

  • By
    WebKit-Specific Style:  -webkit-appearance

    I was recently scoping out the horrid source code of the Google homepage when I noticed the "Google Search" and "I'm Feeling Lucky" buttons had a style definition I hadn't seen before:  -webkit-appearance.  The value assigned to the style was "push-button."  They are buttons so that...

Discussion

  1. Reminds me of a templating variable. Could possibly be used in the case of having non-programming html-designers making the pages.

    Hopefully someone else knows more about the benifits of this. :)

  2. I’m really not sure, but as I used flash and dynamic variable creation, this somehow looks familiar for me. It makes sence in flash, but I don’t know why I should do this in php. I mean, arrays are better that that, right?
    I dunno! Makes me wondering …

  3. echo ${‘name of user’};

    lol, thats useful innit? ;)

    Great site btw. cheers.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!