...

View Full Version : PHP newbie looking for help



rafiki
08-26-2006, 01:51 PM
Hey all im a real beginner to PHP, do any of you have any ideas of simple scripts i can write to get practise?, i will post the script when i have finished so you can check if its ok, heres your chance to really help someone,
Thanks
Rafiki

Anthony2oo4
08-26-2006, 02:11 PM
your best starting reading some tutorials and then practice what they say.

You might want to try starting with adding some numbers together and playing around with varibles.

rafiki
08-26-2006, 02:14 PM
I read a few tutorials and done the "Hello world" but following a tutorial is easy, i want to know if i can come up with simple scripts, then move on to more intermediate scripts, thanks for the advice though

Anthony2oo4
08-26-2006, 02:21 PM
practice some loops, they are easy from a tutorail but once your one ur own they get a bit intimadating.

rafiki
08-26-2006, 02:28 PM
OK you got any idea wat to do with the loops or just make an example?

Anthony2oo4
08-26-2006, 02:31 PM
try getting the code to count to ten.

fist like this:

1, 2, 3, 4 etc

and then down the page

1,
2,
3,
4,

rafiki
08-26-2006, 02:43 PM
<?php

$i=5;
$o=$i--
$p=$o--
$q=$p--
$r=$q--
while($i!=0);

{
echo "$i $o $p $q $r";
}
?>
remember i said i got zilch experience, but this any good?, oh and i currently have no hossting to test scripts on

Anthony2oo4
08-26-2006, 02:48 PM
<?php

$i=5;
$o=$i--
$p=$o--
$q=$p--
$r=$q--
while($i!=0);

{
echo "$i $o $p $q $r";
}
?>
remember i said i got zilch experience, but this any good?

erm no, lol

you could do that without the while loop, all you have done basicly is:

echo "54321";

but nice try. I would have done it like this,

$i = 5;
while ($i > 0) {
echo "$i,<br>";
$i--;
}

that should echo
5,
4,
3,
2,
1,

try it, get youself some hosting and play around.

tripod have it free, or here is a cheap host that I use:

http://platinumhost.co.uk/?p=Order

Start from 0.69

rafiki
08-26-2006, 02:52 PM
i was gonna do it like that but that seemed so tutorial style im looking to do a little more advanced than that
thanks tho

rafiki
08-26-2006, 02:58 PM
any other ideas for practise? ill try do everything basic now lol

iota
08-26-2006, 03:09 PM
First, learn all basic rules of a php programming.
Stick to php manual which is better than tutorials.
Yeah php manual is exactly like tutorial book than usual manual.

It has copy and paste code already.
Read the explanation. Then paste it to your php editor.
( For practise use php expert editor <http://www.ankord.com/phpxedit.html>
It has built-in http server, and you don't have to save every file of your practice.)

Next again,if you want to extend your power of php, download various extensions of GD, PDFLib ..etc. Try testing as said on php manual. Test on both Windows and any Unix variant for php.

rafiki
08-26-2006, 03:25 PM
any more ideas??

Anthony2oo4
08-26-2006, 03:43 PM
iota, i didnt want to confuse him with setting up his own server, but that editor sounds nice, il give it a go. A built in http server is a good idea.

If your looking for something else to work with, try arrays,

rafiki
08-26-2006, 03:54 PM
for some reason i cant dload that program heres a bit of coding with an array
<?php

&drinks = array("Beer","Cider","lager");

&drinks[0] = "Beer";
&drinks[1] = "Cider";
&drinks[2] = "lager";

echo "We serve the following beverages &drinks[0],
&drinks[1] and &drinks[2]"; ?>


this any better?

Anthony2oo4
08-26-2006, 06:58 PM
funny, i just seen tht script in another post here.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum