Author Topic: Tutorial: Starting with PHP  (Read 1092 times)

Hanoko

  • Full Member
  • ***
  • Posts: 188
  • Reputation: 7
  • Listen to my radio www.radioldies.com
    • Oldies Radio
  • Computers: Windows XP, Airis ONE Pad 700
  • iDevices: Ipod Touch 3G 8GB
Tutorial: Starting with PHP
« on: May 09, 2012, 12:32:30 pm »
This is the firs tutorial i have ever done but i think people would like to learn a language that is used a lot to make web pages.

First you have to know is that PHP is server based language. This means that it runs towards the server, the user computer doesn't matter at all, the important thing is the server where the script is running from.

If you want to write code in PHP you will have to write it between this:
Code: [Select]
<?php

?>

It is also accepted:
Code: [Select]
<?

?>

That tells the server that the code between that is writed in PHP.

To write the typical "Hello World" the script should look like this:
Code: [Select]
<?php

//This two bars are to write comment in your code, you should explain what the code is for if somebody is going to read you code
/*You can comment like this too */

echo "Hello World";

?>

I'm going to explain this code. The "echo" what does is print a string that must be between "" (double) or ''(simple), PHP accept both.

THIS IS IMPORTANT:
YOU ALWAYS HAVE TO FINISH EACH LINE OF YOUR CODE WITH ";" .
If you dont do this the script won't work.


Well, I think this should do for the first tutotial. I hope you like it. I will make more tutorials if you want just ask for them.
And no doubt to click the +1.

Thank you for your attention.

« Last Edit: May 10, 2012, 08:52:25 am by Hanoko »
Languages I know:
PHP
HTML
CSS
Javascript(Basic)

FCKSHTUP

  • Full Member
  • ***
  • Posts: 179
  • Reputation: 14
  • If you're good at something, never do it for free.
  • Computers: macbook pro late 2011 (lion 10.7.2)
  • iDevices: ipod touch 4g 5.0.1, iPhone 3g 4.2.1 tmobile unlocked, iphone 4s 5.0.1 trying to unlock, ipod 4 5.1.1
Re: Tutorial: Starting with PHP
« Reply #1 on: May 09, 2012, 05:24:12 pm »
nice tut, I was thinking about learning PHP
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. -Einstein

LavaThemes

  • Dev Team Member
  • Hero Member
  • *****
  • Posts: 757
  • Reputation: 34
  • Aspiring Developer
  • iDevices: iTouch 4
Re: Tutorial: Starting with PHP
« Reply #2 on: May 09, 2012, 07:15:07 pm »
This is a nice guide but you should look into formatting with bbc. It makes tutorials much nicer. +1 for the content though!

FCKSHTUP

  • Full Member
  • ***
  • Posts: 179
  • Reputation: 14
  • If you're good at something, never do it for free.
  • Computers: macbook pro late 2011 (lion 10.7.2)
  • iDevices: ipod touch 4g 5.0.1, iPhone 3g 4.2.1 tmobile unlocked, iphone 4s 5.0.1 trying to unlock, ipod 4 5.1.1
Re: Tutorial: Starting with PHP
« Reply #3 on: May 09, 2012, 07:19:28 pm »
maybe make it go in depth more, maybe variables or something, if there are in PHP
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. -Einstein

A3MIRAL

  • Leader
  • Hero Member
  • *****
  • Posts: 2899
  • Reputation: 105
  • A3MIRAL -- Reporting for Duty
    • A3MIRAL
  • Badges:
  • Computers: Dell XPS15 (6 GB ram, Core i7 @ 2.0 GHz, 750 GB HDD @ 7200 RPM)
  • iDevices: iPod touch 3G 32GB, iPhone 5 32GB
Re: Tutorial: Starting with PHP
« Reply #4 on: May 09, 2012, 08:29:26 pm »
Of course there are variables :/

Don't like seeing ads? Click here to register!

FCKSHTUP

  • Full Member
  • ***
  • Posts: 179
  • Reputation: 14
  • If you're good at something, never do it for free.
  • Computers: macbook pro late 2011 (lion 10.7.2)
  • iDevices: ipod touch 4g 5.0.1, iPhone 3g 4.2.1 tmobile unlocked, iphone 4s 5.0.1 trying to unlock, ipod 4 5.1.1
Re: Tutorial: Starting with PHP
« Reply #5 on: May 09, 2012, 11:27:37 pm »
i suppose every language does, what could you accomplish without em
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. -Einstein

Hanoko

  • Full Member
  • ***
  • Posts: 188
  • Reputation: 7
  • Listen to my radio www.radioldies.com
    • Oldies Radio
  • Computers: Windows XP, Airis ONE Pad 700
  • iDevices: Ipod Touch 3G 8GB
Re: Tutorial: Starting with PHP
« Reply #6 on: May 10, 2012, 08:49:42 am »
okey, i will do another tutorial with the use of variable.
Languages I know:
PHP
HTML
CSS
Javascript(Basic)

Hanoko

  • Full Member
  • ***
  • Posts: 188
  • Reputation: 7
  • Listen to my radio www.radioldies.com
    • Oldies Radio
  • Computers: Windows XP, Airis ONE Pad 700
  • iDevices: Ipod Touch 3G 8GB
Re: Tutorial: Starting with PHP
« Reply #7 on: May 10, 2012, 08:53:36 am »
This is a nice guide but you should look into formatting with bbc. It makes tutorials much nicer. +1 for the content though!

Thanks for the suggestion, i have changed it.
Languages I know:
PHP
HTML
CSS
Javascript(Basic)

C0deH4cker

  • Hero Member
  • *****
  • Posts: 2849
  • Reputation: 129
  • I am leaving iNinjas. Contact me via email.
  • Badges:
  • iDevices: iPhone 4S 16gb Black (5.1.1), iPad 2 32gb White (5.0.1), iPod Touch 2G 8gb (4.2.1)
Re: Tutorial: Starting with PHP
« Reply #8 on: May 10, 2012, 03:20:17 pm »
i suppose every language does, what could you accomplish without em

You can write almost any program without using functions, loops, if statements, and even variables in c. Recursion FTW!!!

H4CK3R

  • Haxor
  • Sr. Member
  • *****
  • Posts: 407
  • Reputation: 42
  • I try and write cool tweaks!
    • Kyle Howells
  • Badges:
  • Computers: MacBook Pro
  • iDevices: iPod 1G, iPod 2G, iPod 4G, iPhone 4S, iPad 2, iPad mini
Re: Tutorial: Starting with PHP
« Reply #9 on: May 10, 2012, 08:43:54 pm »
You can write almost any program without using functions, loops, if statements, and even variables in c. Recursion FTW!!!
No, I'd say you need functions & if statements.

Don't like seeing ads? Click here to register!

C0deH4cker

  • Hero Member
  • *****
  • Posts: 2849
  • Reputation: 129
  • I am leaving iNinjas. Contact me via email.
  • Badges:
  • iDevices: iPhone 4S 16gb Black (5.1.1), iPad 2 32gb White (5.0.1), iPod Touch 2G 8gb (4.2.1)
Re: Tutorial: Starting with PHP
« Reply #10 on: May 11, 2012, 03:30:49 pm »
Try this then:




Code: ("C") [Select]

main(t,_,a )
char
*
a;
{
return!

0<t?
t<3?

main(-79,-13,a+
main(-87,1-_,
main(-86, 0, a+1 )


+a)):

1,
t<_?
main( t+1, _, a )
:3,

main ( -94, -27+t, a )
&&t == 2 ?_
<13 ?

main ( 2, _+1, "%s %d %d\n" )

:9:16:
t<0?
t<-72?
main( _, t,
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
:
t<-50?
_==*a ?
putchar(31[a]):

main(-65,_,a+1)
:
main((*a == '/') + t, _, a + 1 )
:

0<t?

main ( 2, 2 , "%s")
:*a=='/'||

main(0,

main(-61,*a, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry")

,a+1);}



Can you guess what it does?

This is what obfuscated C code looks like, folks.

C0deH4cker

  • Hero Member
  • *****
  • Posts: 2849
  • Reputation: 129
  • I am leaving iNinjas. Contact me via email.
  • Badges:
  • iDevices: iPhone 4S 16gb Black (5.1.1), iPad 2 32gb White (5.0.1), iPod Touch 2G 8gb (4.2.1)
Re: Tutorial: Starting with PHP
« Reply #11 on: May 11, 2012, 03:33:02 pm »
No, I'd say you need functions & if statements.

The only needed variables are provided as function parameters, and you can use the shorthand C comparison ternary operator.