PHP and Javascript

What do you think?

Page 1 of 1

3 Replies - 1024 Views - Last Post: 10 October 2009 - 10:02 AM

#1 nirvanarupali  Icon User is offline

  • D.I.C Stomach
  • member icon

Reputation: 13
  • View blog
  • Posts: 1,119
  • Joined: 01-August 07

PHP and Javascript

Posted 10 October 2009 - 12:19 AM

I have done with C++ few years ago and now I am learning web development. I just finished Head First PHP and MySQL, examples and exercises and now I am reading How to Do Everything with Javascript.

One thing confuse me is this, I have no clue why PHP variables has dollar sign in it. And also in Javascript why if we write a class we use a function keyword instead of class.

I just wonder...can you share your ideas.

This post has been edited by nirvanarupali: 10 October 2009 - 12:20 AM


Is This A Good Question/Topic? 0
  • +

Replies To: PHP and Javascript

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1004
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: PHP and Javascript

Posted 10 October 2009 - 06:09 AM

The $ is just a prefix for variables so it's easier to distinguish from constants, functions, etc.
Was This Post Helpful? 0
  • +
  • -

#3 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2778
  • View blog
  • Posts: 15,880
  • Joined: 24-September 08

Re: PHP and Javascript

Posted 10 October 2009 - 09:21 AM

I'm learning PHP/CSS/MySQL. Javascript seems useless to me atm. :/
Was This Post Helpful? 0
  • +
  • -

#4 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1184
  • View blog
  • Posts: 7,254
  • Joined: 07-September 06

Re: PHP and Javascript

Posted 10 October 2009 - 10:02 AM

Quote

And also in Javascript why if we write a class we use a function keyword instead of class.

That is because Javascript doesn't allow for classes, so each class is really just a function that has sub-functions easily accessed when you create an object. It makes it easier when creating new objects as there are no constructors you can just place your constructor in the body of the class (before, or after the functions) and it will evaluate the code as it goes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1