In this 2 weeks I have been writting PHP4 frequently. Here are some of my thoughts and feels:
- Control structures and operators from C.
- Predefined functions from Perl.
- Easy to output strings. Even that I didn't use the C-like printf, echo can be pretty amazing already:
$word = "Hello World"; echo "<p>I want to say $word to all of you</p>";
- Amazing "array":
As you can see, array is not just an "array", but a rather complex data structure (ordered map).
$arr = array( "firstName" => "Martin", "lastName" => "Ng" ); echo "<p>I'm $arr['firstName'] $arr['lastName'].</p>";
- Weak typing.
- Magic quotes, which escapes single quote, double quote and NULL in GET/POST/Cookies with a backlash, is turned on by default. I think this is a big mistake.
- The member accessor in C family languages are well known as the dot operator (or "->" if the class is defined as pointer). e.g.
document.createElement( "hr" );. However, PHP uses "->" only (because everything is called by reference? I'm not sure...).
- The dollar sign for variables. I just hate it. Frequently forget to type "$" when using variables.
- The $this pointer. Why do I need to type $this->something when I'm just referencing some member variables/functions?
- While all C family languages use "else if", PHP uses "elseif".
- String concatenation operator is ". (a dot)", rather than "+" in C family languages.
- I prefer "<% ... %>" (as seem in ASP and JSP) over <?php ... ?>.
Look like I hate it more. Anyway, can't complain too much to a free software...