Forum Moderators: coopster

Message Too Old, No Replies

Where to start?

want to learn PHP

         

Pozo

4:08 pm on Feb 22, 2010 (gmt 0)

10+ Year Member



I am a CS student and can code in C++. I know the basics of HTML and a little Java Script. Want to learn how to code in PHP.
Where should I start?

Readie

4:31 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World Pozo.

Umm, I learnt in a bit of a wierd way myself, but I suppose a good tutorial (havn't been through it myself) might be [w3schools.com...] - they're usually quite good.

Matthew1980

4:33 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Pozo,

Welcome to the forum, [w3schools.com ] would be a good place to start. That should take you in the right direction, oh, and php.net ;-p

Good Luck,

MRb

Matthew1980

4:34 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Great minds eh? Readie! lol!

Readie

4:40 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



:D

They're usually my go-to-place if I have a problem with PhP and php.net fails me, and my first stop when I have issues with HTML/CSS/JS

Pozo

4:49 pm on Feb 22, 2010 (gmt 0)

10+ Year Member



Thankyou!
Well then w3schools.com it is!

Pozo

4:59 pm on Feb 22, 2010 (gmt 0)

10+ Year Member



Which posts in this forum do u think can help a beginner?

Anyango

5:00 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Pozo i would say WebmasterWorld.com is the best place for you if you are ready for the challenge. The learning curve is always easier if you are in a company of so many talented people to guide you. Im sure soon someone will post links of many usefull threads from this forum which will help you get started. Please also check forum library. Have you already set up your PHP?

Pozo

5:06 pm on Feb 22, 2010 (gmt 0)

10+ Year Member



For sure I am Anyango. I am really looking forward to my learning experience here at WebmasterWorld.com. I am surfing through the library.
And yes, I have already set PHP up.
Thank you

Anyango

5:29 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As you mentioned you can program in C++, PHP wont be tough for you. what about trying a simple hello world code and posting it here ? or if you want to go 1 step further, Post something that you have done yourself so far

Pozo

5:39 pm on Feb 22, 2010 (gmt 0)

10+ Year Member



I hope I am on the right track Anyango...

<html>

<head>
<title>PHP Test</title>

</head>

<body>

<?php

echo "<font face=\"Arial\" color=\"blue\">I guess I can I am learning...</font>";

?>
</body>

</html>

Anyango

5:48 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To make things easier, you can also use this

<?php

echo "<font face='Arial' color='blue'>I guess I can I am learning...</font>";

?>

or

<?php

echo '<font face="Arial" color="blue">I guess I can I am learning...</font>';

?>

You have escaped quotes good but keep things simple as much as you can. In Php we can echo any string enclosed in both ways, either enclosed in single quotation marks, or in double quotation marks. The difference is that if you are trying to echo a php variable within quotes, it will only work enclosed in double quotes, not in single quotes.
For example

<?
$value=1;
echo "Value is $value"; // will output Value is 1
echo 'Value is $value'; // will output Value is $value

So your variable will not be parsed in single quotation marks.

Pozo

5:59 pm on Feb 22, 2010 (gmt 0)

10+ Year Member



Ok. What when print() is used instead of echo for output? Only double quotes will parse the variable even then?

Anyango

6:12 pm on Feb 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, a variable will work only when outside quotes, or in double quotes. Wont work in single quotes. and for added information, if you have to read an array variable within double qoutes you can use this

$myArray["a"]="Testing";
echo "value of {$myArray['a']}";

Notice the use of { }

CyBerAliEn

8:24 pm on Feb 22, 2010 (gmt 0)

10+ Year Member



The fact that you already know C++ means you'll be able to transition over to PHP very easily! It is incredibly similar in many ways (though perhaps more so to just C?).

I usually use PHP.net as my reference for functions that I'm not familiar with. As you program PHP, note that PHP has MANY! functions already built into it that will help you in your programming. It has a "library" of functions for handling arrays, strings, databases, math, and much more! It's a great place just to surf to see what functions it has and how they work.

Function reference: [php.net ]

Specifically, the following are great beginner places to look at:
[php.net ]
[php.net ]
[php.net ]

Since you are already familiar with programming... your best approach to learning PHP might be to look up examples or tutorials. Copy the code over, run it, modify it, run it, etc.

Pozo

8:56 am on Feb 23, 2010 (gmt 0)

10+ Year Member



Thank you CyBerAliEn

php.net really is a great help