Jump to content
MakeWebGames

PHP


chinion

Recommended Posts

Well I am 14 years old I am quite smart for my age and I really want to learn PHP and help people build games or even with a fund my own game, I have sat there for about an hour on http://www.w3schools.com and tried to learn it and cant understand one bit....is there anyone here who has teamviewer and would like to take out some time to TRY and teach me PHP in the simplest way possible please then if there is then add me on my msn.....Thanks

MSN >> [email protected]

Link to comment
Share on other sites

If you are really interested in learning php I would advise you to invest £50 in a few books, reading from a book will help you learn twice as fast I

myself started online tutorials a week later I could just about male a script that could echo a $_POST variable I went to my library loaned a book in that 2 weeks I had the book i made guest book using a db (not much but it was something) now look 1.5 years on I like to think I can code to a decent standard.

I'll get the ISPN of a book I brought (£30) and it covers php/MySQL.

Link to comment
Share on other sites

http://search.oreilly.com/?q=php

- Removed.

http://www.videophpblog.com/

http://www.phpvideotutorials.com/free

download some

http://www.phpclasses.org/

Theres no simple way dude !

Before you learn PHP in w3 school is mentioned some requirements such as JavaScript etc.

Skipping those steps is hard. Books are your best teacher Makewebgames is your best teacher :)

And the second teacher is Google of course ! have courage and try Google.

Link to comment
Share on other sites

Thanks for all your feedback, I will check the sites you sent me and maybe even lookin into buying the book

*Later On*

Learnt some basic stuff but it was thanks to phpacademy

<?php

$Variable = "Thanks";

$Variable2 = "Everyone";

echo "$Variable" to "$Variable2" that sent me info on what to do and where to go for my php learning stages

?>

---------------------

That was just some BASIC variables

Link to comment
Share on other sites

Also I don't think any one script said php.net is invaluable look up some functions you see around the place

Also you don't have to buy the book ask your local libary if they haven't got a book on php I'm sire they can get one from another libary

Link to comment
Share on other sites

http://www.phpvideotutorials.com/free - Use the old vids then when you have finished use w3scools.

http://mccodes.com/viewengine.php?id=2 - Play around with this try to read code and make an add on or two or even make your own website, its better to learn by doing.

I am 15 and when you get the hang of it's easy!

One last note: If you get stuck google it before asking for help ;)

Link to comment
Share on other sites

I personally used KillerPHP.com way back then, i found his videos to be 100% detailed and explanatory. Give them a try to get started, I was 15 when i learn and it takes about 6 months to learn and remember enough to start making a website, give or take a few months depending on your Intellect.. I'm stupid, so 6 months for me. :thumbup:

Link to comment
Share on other sites

<?php

$Variable = "Thanks";
$Variable2 = "Everyone";

echo "$Variable" to "$Variable2" that sent me info on what to do and where to go for my php learning stages

?>

Incorrect.

WHY NOT TELL HIM WHERE HE IS INCORECT (soz for the caps i had caps loc k on and CBA to re write :P)

chinion you need to add "" or '' arounf the text you want to echo to the page (plus a ; at the end of each line of code) and you need to add {} around the varables

Link to comment
Share on other sites

<?php

$Variable = "Thanks";
$Variable2 = "Everyone";

echo "$Variable" to "$Variable2" that sent me info on what to do and where to go for my php learning stages

?>

 

Should actually be:

 

<?php

$Variable = "Thanks";
$Variable2 = "Everyone";

echo $Variable ." to ".$Variable2." that sent me info on what to do and where to go for my php learning stages";

?>
Link to comment
Share on other sites

$Variable = "Thanks";
$Variable2 = "Everyone";

echo "$Variable" to "$Variable2" that sent me info on what to do and where to go for my php learning stages

?>

 

Should actually be:

 

$Variable = "Thanks";
$Variable2 = "Everyone";

echo $Variable ." to ".$Variable2." that sent me info on what to do and where to go for my php learning stages";

?>

 

Here is an easier way to read it:

 

$Variable = 'Thanks';
$Variable2 = 'Everyone';

echo  $Variable .' to '.$Variable2.' that sent me info on what to do and where  to go for my php learning stages';

?>

 

I prefer single quotes but thats just me.

 

Link to comment
Share on other sites

I use double quotes for HTML and single for PHP usually as it's easier for example:

 

<?php

$haidere= ":P";//This is a comment and you may see that I used a double quote for the variable thats just another thing I do, You can switch between the two.

echo '<html>
<head>
<title>
Ummm
</title>
</head>
<div id="You see here!">
<body>
HAHAHA DON\'T  '; echo $haidere;
echo '
</body>
</html>';


?>

 

Also when something like the word "don't" needs a ' you will need to escape it by putting a \ in front of it so it doesn't interfere with the script.

Link to comment
Share on other sites

Double quotes accept variables inside. singles don't

so

//this is correct
echo  $Variable .' to '.$Variable2.' that sent me info on ...';
//olso
echo  "$Variable to $Variable2 that sent me info on...";
//and the Dayo way
echo "This is my {$array['username']} with {$normalVar} plus {$array['password']} lovely ?";

 

Another good example:

( this way you can validate block of code (html) inside an IDE like netbeans )


<?php
$haidere= ":P";
?>
<html>
 <head>
   <title>Ummm</title>
 </head>
<body>
<h1><?php echo $haidere; ?></h1>
</body>
</html>
Link to comment
Share on other sites

Whilst we're on the subject of echo and concatenation methods, anybody use (,) rather than concatenation (.) when using echo?

echo $myName ,' is ', $awesome;

 

I was told it is faster than Concatenation and only works with Echo, I've tried it with echo and it does work without error. Anyone else seen/used this?

Link to comment
Share on other sites

The dot and comma do different things in echo.

The comma is for separating parameters. Think of echo as like a function: echo ('hi', 'bla', 'bla'); All this does is echo hi, then echo bla, then echo bla.

The dot is for concatenating strings together. If you use echo 'hi' . 'bla' . 'bla', what PHP does is:

Create a new string 'hiblabla', and THEN echo it.

As you can probably guess, using comma is faster (not by much) because php doesn't need to concatenate the parts into a new string, it just echoes each part directly.

Link to comment
Share on other sites

Well, string concats are more computationally expensive than just outputting text on a screen.

Yes, 1 echo is faster than 3 echoes, but 1 echo + x-1 string concats is slower than x echoes.

PHP needs to 'reconstruct' the string with each concatenation.

So to go deeper into my previous example with 'hi' . 'bla' . 'bla', PHP does this:

create new string 'hibla'

create new string 'hiblabla'

return 'hiblabla'

 

Edit: this is also why it's 'faster' to use heredoc syntax rather than a whole series of $text .= 'bla'; $text .= 'bleh', etc.

Or 'faster' to use echo "{$variable} blabla" rather than echo $variable . "blabla". (actually I'm not sure about this one)

But the speed difference is really not noticeable, everybody should just use the format that they prefer to code in.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...