Why do we have the dollar sign before every php variable?

Let’s learn why do we have the dollar sign before every php variable. The most accurate or helpful solution is served by Stack Overflow.

There are ten answers to this question.

Best solution

What does the dollar sign mean in php in regards to oop?

Going through this code (sorry for the newb factor): <?php // Class class Building { // Object variables/properties public $number_of_floors = 5; // These buildings have 5 floors private $color; // Class constructor public function __construct($paint) { $this->color = $paint; } public function describe() { printf('This building has %d floors. It is %s in color.', $this->number_of_floors, $this->color ); } } // Build a building and paint it red $bldgA = new Building('red'); // Tell...

Answer:

You are right, the $ is for variable. But in a class instance, you don't use $ anymore on properties...

Read more

user784637 at Stack Overflow Mark as irrelevant Undo

Other solutions

Answer:

the dollar sign appears before a variable/array.  Essentially it just tells php that its a variable...

Read more

wiki.answers.com Mark as irrelevant Undo

Why won't this simple PHP code not work?

Regarding Preg_Replace function in PHP Greetings. I am trying to use the Preg_Replace function to replace a string variable with another string. This works fine when the string I'm looking for is written out, such as "This is my string." However...

Answer:

You are trying to replace a string, as such you should use str_replace instead. See: http://php.net...

Read more

canterbu... at Yahoo! Answers Mark as irrelevant Undo

Is there anything like CoffeeScript for PHP?

PHP interpreters are very common, but the PHP syntax & libraries are inconsistent & cumbersome (IMO, of course). I think a language that compiles into PHP but provides higher level level features (like, modules, mixins, list comprehensions, etc...

Answer:

Ruby to PHP: http://www.fructoselang.org/

Read more

Mike Cantelon at Quora Mark as irrelevant Undo

Question about the Dollar? Dollar Sign That is?

Question about the Dollar? Dollar Sign That is? When I was in 8th (1954) grade I had a class titled “Business Math”. The teacher explained the U. S. Dollar sign was a “U” for United, and a “S” for States laid over...

Answer:

I am young and know what you are talking about. I love the real dollar sign, I have no idea.

Read more

GetSkinn... at Yahoo! Answers Mark as irrelevant Undo

please help me fix a php sign in form?

how can I fix a php sign in broken after an upgrade to PHP 5.x? I maintain a website on dreamhost (which recently ungraded their PHP to 5 something.) Our site (which is old and will be replaced) is written in a previous version of PHP. Now the signin...

Answer:

Minor addendum: if you grep the script for '_GET' or '_POST' and come up empty, it is almost certainly...

Read more

canine epigram at Ask.Metafilter.Com Mark as irrelevant Undo

Does a UK Pound sign show up as a pound sign or as a dollar sign for people in USA?

Here is a UK pound sign: £ Here is a USA dollar sign: $ Do they look the same on American computer screens?

Answer:

We see it as you meant it to appear. I see £ when you type pound I see$ when you type Dollar.

Read more

bearlily at Yahoo! Answers Mark as irrelevant Undo

Browser interpreting PHP code as HTML after -> sign. How can I stop it?

I am working on a website using XAMPP. PHP is configured correctly. There is no syntax error in the code. File extension ends in .php. I point to it by http://localhost/file.php. Here is the code: <?php include_once('simpleDom.php'); $target_url...

Answer:

please check that there are no short tags in the code such as <? ?> because short tags are off...

Read more

Faizan Ali at Quora Mark as irrelevant Undo

When should I use double equals sign instead of triple equals sign in PHP?

I know triple equals sign also compare types of variables. But, What's the rationale beyond this? Where to use double equals sign?

Answer:

$a == $b if $a and $b are equivalent. 3.0 == 3 is true. $a === $b if $a and $b are identical. (Type...

Read more

Edward Yu at Quora Mark as irrelevant Undo

Hi! $ means one dollar (with one l). Does the dollar sign with 2 vertical lines (ll) stand for anything?

I mean in the Scrooge McDuck world the dollar sign has 2 lines but in the real world does it stand for anything....? I have heard from someone that it means one million dollars but I don't know if this is true.

Answer:

I Thought It Was The Same Thing..... All Bank Statements I Get Have The 2 Lines....And One The I-Net...

Read more

24_m_gr at Yahoo! Answers Mark as irrelevant Undo

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.