Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

CodeSnipers.com:
Data Types - PHP Vs. Ruby
Oct 26, 2005 @ 10:35:44

In this new post on CodeSnipers.com today, Nola compares some of the data types between PHP and Ruby.

In conversation with a fellow PHP person now doing Perl, he asked… how does Ruby do types?? And I thought I knew how to answer him, but then when I opened my mouth I found I didn't have the words.

PHP is not a strongly typed language. You can assign $foo an integer, print it (even though it does not contain a string), assign an array and so on. PHP doesn't care.

However, if you want to be certain of the type in a variable there are a few functions to help you out.

She doesn't really mention the Ruby datatypes (see here for that...), but she does mention some good ways to ensure that your variables contain what you think they should - or change them so they do...

tagged:

Link:


Trending Topics: