# php7- dropping the $ from the variable name - rfc

- Thread: https://externals.io/message/40544
- Original archive: https://news-web.php.net/php.internals/40544
- Started by marius popa on 2008-09-18T14:47:34+00:00
- Messages: 18
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #40544 — marius popa — 2008-09-18T14:47:34+00:00

URL: https://externals.io/message/40544#40544

I was looking at the examples used in php.js library
http://phpjs.org/functions/index
and it struck me that is cleaner to read the functions and code without the
$ names in it

From what i understand  $ in front of variables is an Perl legacy

-- 
developer flamerobin.org

---

## #40545 — Rasmus Lerdorf — 2008-09-18T14:58:33+00:00

URL: https://externals.io/message/40544#40545 · In reply to: #40544

marius popa wrote:
> I was looking at the examples used in php.js library
> http://phpjs.org/functions/index
> and it struck me that is cleaner to read the functions and code without the
> $ names in it
>
> > […]

And how do you propose to do string interpolation?

echo "This is a $var in a string";

or:

echo <<<EOB
This is a $var in a heredoc
EOB;

This is the heart and soul of PHP which isn't possible without a way to 
identify a variable.  I suppose you could argue that you would have two 
ways to indicate a variable, $var for interpolation and var without, but 
that gets even messier.  One consistent way is cleaner.

-Rasmus

---

## #40546 — kris@koehntopp.de — 2008-09-18T15:26:04+00:00

URL: https://externals.io/message/40544#40546 · In reply to: #40545

> And how do you propose to do string interpolation?

You could do it using an interpolation operator in String constants.
echo "This is a #{var} in a string."; /* Ruby does it using this */


But why break compatibility for a purely aesthetical problem?

Kris

-- 
Kristian Köhntopp
https://www.xing.com/profile/Kristian_Koehntopp
http://blog.koehntopp.de

---

## #40547 — mike — 2008-09-18T17:38:43+00:00

URL: https://externals.io/message/40544#40547 · In reply to: #40544

> I was looking at the examples used in php.js library
> http://phpjs.org/functions/index
> and it struck me that is cleaner to read the functions and code without the
> $ names in it
>
> From what i understand  $ in front of variables is an Perl legacy

This is an utterly horrible idea. No offense. Why would you  change
the entire syntax of the language? I don't think any language has
-ever- changed it's syntax like that once it's been established...

Personally I love the $. It makes it so much easier to identify
variables. It's a single character. Can't see the need honestly to
even bring this up.

---

## #40548 — Brian Moon — 2008-09-18T18:06:11+00:00

URL: https://externals.io/message/40544#40548 · In reply to: #40547

mike wrote:
> Personally I love the $. It makes it so much easier to identify
> variables. It's a single character. Can't see the need honestly to
> even bring this up.

+1,000,000.  Horrible idea.  *facepalm*

-- 

Brian Moon
Senior Web Engineer
------------------------------
When you care enough to spend the very least.
http://dealnews.com/

---

## #40549 — Jordan Moore — 2008-09-18T18:25:52+00:00

URL: https://externals.io/message/40544#40549 · In reply to: #40548

> mike wrote:
> > […]
>
> +1,000,000.  Horrible idea.  *facepalm*
>
> --
>
> Brian Moon
> Senior Web Engineer
> ------------------------------
> When you care enough to spend the very least.
> http://dealnews.com/
>
>
> --
> 
> 
>
>

I'm unsure how the parser works, so ignoring those potential issues,
this change would...

1. Break every single PHP script that is currently in existence.

2. Break syntax highlighting (and probably other tools/functions) for
every IDE that is currently in existence.

I'm not sure that much more needs to be said.

-- 
Jordan Ryan Moore

---

## #40552 — Michael Wallner — 2008-09-18T18:52:07+00:00

URL: https://externals.io/message/40544#40552 · In reply to: #40547

mike wrote:
^^^^

...

Would you mind using your full name or something else? Thanks :)
Not that I'd have a (tm) on mike, but anyway...

Cheers,
Mike

---

## #40554 — mike — 2008-09-18T19:08:01+00:00

URL: https://externals.io/message/40544#40554 · In reply to: #40552

Thu, Sep 18, 2008 at 11:52 AM, Michael Wallner <mike@php.net> wrote:

> Would you mind using your full name or something else? Thanks :)
> Not that I'd have a (tm) on mike, but anyway...

i have to give props to you having mike@php.net, but as of right now i
am not ready to make the official change on my name yet :)

i don't really post to internals often so you probably won't see much
of me anyway :)

---

## #40559 — Greg Beaver — 2008-09-18T22:10:34+00:00

URL: https://externals.io/message/40544#40559 · In reply to: #40544

marius popa wrote:
> I was looking at the examples used in php.js library
> http://phpjs.org/functions/index
> and it struck me that is cleaner to read the functions and code without the
> $ names in it
> 
> From what i understand  $ in front of variables is an Perl legacy

This would also eliminate constants from PHP, as currently they are
 `T_STRING` and variables would become T_STRING.  Not a good idea.

<?php
define('oops', 1);
$oops = 2;
echo $oops,' ',oops;
?>

Thanks,
Greg

---

## #40561 — Hannes Magnusson — 2008-09-19T08:50:27+00:00

URL: https://externals.io/message/40544#40561 · In reply to: #40544

> I was looking at the examples used in php.js library
> http://phpjs.org/functions/index
> and it struck me that is cleaner to read the functions and code without the
> $ names in it
>
> From what i understand  $ in front of variables is an Perl legacy


I totally agree. Its really annoying needing to type $ all the time,
not to mention how hard it is on Norwegian keyboards. Lets replace it
with £ !
There is even a "patch" available:
http://php.markmail.org/message/jsex75rowudeu2nr

-Hannes

---

## #40562 — troels knak-nielsen — 2008-09-19T08:59:38+00:00

URL: https://externals.io/message/40544#40562 · In reply to: #40561

On Fri, Sep 19, 2008 at 10:50 AM, Hannes Magnusson
<hannes.magnusson@gmail.com> wrote:
> I totally agree. Its really annoying needing to type $ all the time,
> not to mention how hard it is on Norwegian keyboards. Lets replace it
> with £ !
> There is even a "patch" available:
> http://php.markmail.org/message/jsex75rowudeu2nr

£ is just as hard. Let's replace it with the international
currency-symbol ¤ (Yes, that's what that weird symbol for, in case
you've always wondered about it).

--
troels

---

## #40564 — Dmitry Stogov — 2008-09-19T10:39:02+00:00

URL: https://externals.io/message/40544#40564 · In reply to: #40559

Greg Beaver wrote:
> marius popa wrote:
> > […]
> 
> This would also eliminate constants from PHP, as currently they are
> `T_STRING` and variables would become T_STRING.  Not a good idea.
> 
> <?php
> define('oops', 1);
> $oops = 2;
> echo $oops,' ',oops;
> ?>

From my point of view, it's not a good idea to have classes, functions,
constants and variables with the same "conflicting" names (PHP way).

Anyway, I'm not going to change it.

Thanks. Dmitry.

---

## #40566 — Andrey Hristov — 2008-09-19T12:10:48+00:00

URL: https://externals.io/message/40544#40566

Asbjørn Sloth Tønnesen wrote:
> Hannes Magnusson wrote:
> > […]
> 
> Like most programming languages PHP is optimized for American keyboard
> layout, deal with it!
> 
> Fx. I especially like the placement of the MySQL escape character ` on
> Nordic keyboards: press Alt-gr and |, release them and then press space.
> 
> > […]
> 
> Way to go, lets make a port of all major programming languages, to all
> keyboard layouts. ;-)
> 

Those of use who use non-latin based languages in a better position -
need to learn a new layout, the US one. Even in Bulgaria althought there
is a national standard for a keyboard layout second one emerged during
the years which is based on a transliteration of QWERTY. However, using
the QWERTY layout one is slower compared to the case when using the
national standard. OTOH, layout switching is pretty easy nowadays, you
might install a qwerty layout for programming (/me has nowadays US, DE
and BG installed to handle all the communities I am involved in :)

Best,
Andrey

-- 
Andrey Hristov, Connectors Software Developer, Database Group
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering

---

## #40567 — mike — 2008-09-19T19:08:09+00:00

URL: https://externals.io/message/40544#40567 · In reply to: #40561

On Fri, Sep 19, 2008 at 1:50 AM, Hannes Magnusson
<hannes.magnusson@gmail.com> wrote:

> I totally agree. Its really annoying needing to type $ all the time,
> not to mention how hard it is on Norwegian keyboards. Lets replace it
> with £ !

can we make PHP whitespace dependent too? might as well. :)



note: i am absolutely NOT actually requesting this.

---

## #40578 — Derick Rethans — 2008-09-20T18:06:34+00:00

URL: https://externals.io/message/40544#40578 · In reply to: #40544

Please stop this useless thread, it's wasting everybody's time.

regards,
Derick

-- 
HEAD before 5_3!: http://tinyurl.com/6d2esb
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org

---

## #40766 — marius popa — 2008-09-29T12:12:46+00:00

URL: https://externals.io/message/40544#40766 · In reply to: #40549

> 
> > […]
>
> I'm unsure how the parser works, so ignoring those potential issues,
> this change would...
>
> 1. Break every single PHP script that is currently in existence.
maybe an legacy mode can be included in ini
>
> 2. Break syntax highlighting (and probably other tools/functions) for
> every IDE that is currently in existence.
this can be fixed by each ide , I talk about something like
>
> I'm not sure that much more needs to be said.

I can give another practical example in  wxjscript
from this javascript example that can be run on apache server you can see
that is simpler to read and to learn at least for an beginner
http://www.wxjavascript.net/mysql/index.html

What i want to say is that php must go forward and yes you can
change/break things in the engine
like in the php 4 to php 5 migration or php5 to php6

In time maybe an fast javascript engine could replace php if it
doesn't change in the right direction
or it goes to java bloatware way

>
> --
> Jordan Ryan Moore
>



-- 
developer flamerobin.org

---

## #40773 — Hartmut Holzgraefe — 2008-09-29T13:33:48+00:00

URL: https://externals.io/message/40544#40773 · In reply to: #40766

marius popa wrote:

> > […]
> maybe an legacy mode can be included in ini

we want less of such legacy mode options, not more

plus this would have to be configured per application
and not just per server

> > […]
> this can be fixed by each ide , I talk about something like

sure it can be fixed, but you missed the *every* part

plus IDEs, editors, highlight tools etc. would have to support
both old and new for quite a while


> > […]
> I can give another practical example in  wxjscript
> from this javascript example that can be run on apache server you can see
> that is simpler to read and to learn at least for an beginner
> http://www.wxjavascript.net/mysql/index.html

so instead of clearly marking variables with $ as such
there they need to be declared with 'var' instead, and
'->' is replaced by '.' ...

... i don't see much of a difference there from a learning
point of view though


> What i want to say is that php must go forward and yes you can
> change/break things in the engine
> like in the php 4 to php 5 migration or php5 to php6

sure we can break things if there is a compelling reason
to do so, i'm just totally missing the compelling part here ...


-- 
Hartmut Holzgraefe, MySQL Regional Support Manager EMEA

Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering

---

## #40775 — David Coallier — 2008-09-29T13:45:12+00:00

URL: https://externals.io/message/40544#40775 · In reply to: #40773

>
> sure we can break things if there is a compelling reason
> to do so, i'm just totally missing the compelling part here ...
>
>

This is not going to happen. This thread is over.

-- 
Slan,
David
