Reply to Re: Dynamically typed

Your name:

Reply:


Posted by Erwin Moller on 05/17/06 14:14

munna wrote:

> Why scripting languages are dynamically and weakly typed? and why none
> of the scripting languages is compiler based?
> why cant a scripting language be use like java or c++ where we can
> catch type errors e.g. (string being assigned to an integer),
> parameter passing at compiled time.
>
>
> what is the significance of multiple dollar sign ($$...$var) in php?
> e.g.
> $var = "profession";
> $$var = "doctor";
> $$$var = "khalid";
> and so on...

Why do I always end up in a trafficjam if I take the car?
Why do I browse this newsgroup, and answer this question while your negative
attitude irritates me a little?
Why do I always end up with a hangover if I drink a lot?
and so on...

To your 'questions':

- PHP juggles types around to make things easier, at least that was the
intent of the builders.
If you don't like loose typed variables, cast them to something you DO like
when you use them.
$someVar = "12.3";
now $someVar is a string, however, if you use it like:
$summed = 12 + $someVar;
it will be interpreted as a float.

So if you want your variables strongtyped, pick another language or cast
them always before using.

Start here: http://nl3.php.net/manual/en/langref.php
Read at least that whole chapter (Language reference) before asking basic
questions.

About the $ sign, it is a substitutemethod for variable-adressing.
$var = "profession";

// Simple: Now $var contains a String.

$$var = "doctor";

Now you created a variable named $profession with value "doctor".


$$$var = "khalid";

No clue, probably more of the same.
I never use such strange languageconstructs.

Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация