Results 1 to 1 of 1
Threaded View
-
8th May 2009, 04:48 PM #1OPMemberWebsite's:
litewarez.net litewarez.com triniwarez.comPHP tutorial
Heya webmsaters..
ive seen a few of you the are oblivious to php so im going to starts a tutorial / guide for you all
Ok so lets begin
______________________________________
Tutorial Info:
Name: Simple Functions.
Level: Basic.
Writer: Cornetofreak
ok so im going to start by explaining the most popular but the most basic functions you will come across whilst creating your script/software.
1.
The first function ill be talking about is the "echo" function, this function is used to print a string of information to the web users screen.
Example:
PHP Code:<?php
echo 'FooBar';
?>
2.
The second function ill be showing you is the "print()" function, nor comparing this to echo theres not alot of difference but a few little things
echo is not actually a function where as print() is and because it act's like a function it will then return data so echo is actually faster
PHP Code:<?php
$ret = print("Hello World");
$ret would have the value of 1, this is because print() can be used as part of a more complex expression where echo cannot.
so it is always advisable to use "echo" to print strings to the screen and there's no need to use "print()"
Now ill be showing you how to use the "if(){}" statement.
if statements are one of the most commonly used in creating a script.
all programming languages are built around the one thing that we have in common with other humans and that's logic
logic is hard to explain but we use it in everyday life.. below are some examples of how you would use logic in your normal day and then ill change into the program form..
Human Form:
If you want a piece of toast then shout to your mom
How i interoperate this:
If (you want a piece of toast) then {shout to your mom}
Program Version:
PHP Code:<?php
$You_Want_Some_toast = true;
if($You_Want_Some_toast){
echo 'Mom can i have some toast';
}
?>
if statements basic check the expression you give with the braces so here are some more examples of if statements.
PHP Code://Example 1.
if(true){
die("I was true");
}
//Example 2.
$foo = true;
$bar = false;
if($foo !== $bar){
die("Foo is not exactly the same as Bar");
}
//Example 3.
$value1 = 20;
$value2 = 20;
$answer = 40;
//Ok so we know if we do this 20+20 this would equal 40 so lets do it with if statements.
if( ($value1 + $value2) == $answer ){
die("20 + 20 equals 40");
}
PHP Code:$value1 = 20;
$value2 = 10;
$answer = 40;
if( ($value1 + $value2) == $answer ){
die("20 + 10 equals 40");
}else{
die("20 + 10 does NOT equal 40");
}
ok so now we have gone over a few of the basics if you like the tutorial ill carry on and create some more showing you how to uses mysql, foreach, and help you get further to learning php.
Thanks.litewarez Reviewed by litewarez on . PHP tutorial Heya webmsaters.. ive seen a few of you the are oblivious to php so im going to starts a tutorial / guide for you all Ok so lets begin ______________________________________ Tutorial Info: Name: Simple Functions. Level: Basic. Rating: 5Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
MP5 tutorial?
By Divvy in forum Webmaster DiscussionReplies: 10Last Post: 12th Apr 2011, 11:43 PM -
mp5 tutorial
By ktrich2 in forum General DiscussionReplies: 2Last Post: 22nd Mar 2011, 10:31 AM -
MPU Tutorial
By Kenith in forum Tutorials and GuidesReplies: 4Last Post: 17th Jul 2010, 01:15 PM -
vB Skin tutorial
By pankaj in forum Graphics AreaReplies: 10Last Post: 6th Jul 2010, 10:52 AM -
CSS Tutorial Anyone?
By Chri5 in forum General DiscussionReplies: 14Last Post: 5th Jan 2010, 05:13 AM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...