Talk:PHP Programming/Beginning with "Hello World!"

Typelessness does not imply strong or weakly typed
The fact that a variable does not have type does not make a language strong or weakly typed, Lisp for example is strongly typed but the type is linked to the value not the variable. This is called dynamically typed: type check at runtime.

C and C++ are not strongly typed: e.g. you can add integers to a pointer for example. Both these languages are called statically typed because they need to know the type at compile time.

So we have two axes: dynamic vs static which have nothing to do with strong vs weak.

Output
ommm, that's gonna output Hello world!Hello world!Hello world!Hello world! 4 times.

could we break the example up into 4 seperate chunks of  or something to let the reader know that if he copies & pastes the source, he won't get the output listed?


 * Yeah, I saw that but I was too lazy to fix it. :P  It draws out one of the problems with the code template I made, so I'm debating whether to change the template or change the page content.  I tried to keep it exactly the same as it was previously so it would be easy to remove the template.  *shrugs*  I'll have to look at it later (or someone else can fix it up).  --banzaimonkey 08:33, 10 August 2006 (UTC)
 * Fixed. I broke it up into two examples. --Karl McClendon (talk) 14:03, 18 February 2008 (UTC)

echo !=print
it's not true that echo and print behave the same - echo does not return an exit code opposite print. so if(echo "bla bla") wouldn't work, while if(print "bla bla") should work as expected.
 * Fixed (well more or less). The opening statement already noted the difference, so it was just the 1 sentence at the end of the print section that needing correcting.  Thanks for pointing out the error --Ahc 20:00, 17 Dec 2004 (UTC)

I added a note on one of the echo examples informing the reader that commas can be used to concatenate echo output, but not print output. If the formatting is incorrect, please tweak it. --banzaimonkey

Double Quotes ( " ) vs. Single Quotes ( ' )
I did a quick find-replace in my practice script and there doesn't seem to be a difference between using single quotes ( ' )or double quotes ( " ). Is there some difference of which I'm not aware, or is it up to user preference? --banzaimonkey


 * The example should be more clear. If you use double quotes, you can inject variable contents easily. All variable start with the escape character DOLLAR_SIGN

$topping = 'gnanendra .p'; $order = "large $topping pizza";


 * This is equivalent to:

$order = "large ". $topping. " pizza";


 * In any sane language, that would be:

String topping = "pepperoni"; String order = "large " + topping + " pizza";


 * Personally, I dislike the FULL_STOP character for combining strings, so whenever I can I exploit the $ syntax. --Ed Poor (talk) 23:23, 14 February 2008 (UTC)

Line Breaks
A good programming tip might be to add whitespace (perhaps along with an explanation of whitespace) to line breaks to increase readability. --banzaimonkey

Polish
I think its about time to do some polishing and re-structuring of this page. I think that the hello world examples and the topics on variables and whatnot should be split up to different pages since those topics should be discussed in length. --Karl McClendon (talk) 22:06, 19 February 2008 (UTC)

Nice job
The PHP programing is nicely written. I see I can manage it. Easy and fast to learn. Thank You! --147.231.138.108 (talk) 22:06, 26 July 2010 (UTC) (user Reo On on w:)

Incomprehensible sentence
I don't think the following fragment (in section Real world analogy) makes sense, in particular near code>$.


 * ... and the box is represented by the code>$ and how the data is stored in memory.

Do you agree? If yes, what should it be?

--Mortense (talk) 13:08, 5 December 2010 (UTC)


 * It should be "represented by the $" but the code tags around it were wrongly formatted. It's still not clear what it's talking about though. I think it's stretching the analogy too much. 81.187.215.34 (discuss) 23:21, 2 July 2016 (UTC)