|
   |
|
|
Tut: Basic Functions with PHP
Tutorial name: Functions with PHP You're experience: Advanced Difficulty: Average Time Taken: 1-2 minutes Plug-ins needed: none. Functions with php are fairly simple. First of all what is a function? it is a small tid bit of code that is ran each time it is called, and it allows for information to be returned, outputted, and inputted. In away, you can replace classes with functions, it ain't to hard, but it is possible. I use functions rather than classes because i feel more comfortable with them. i will show you two things, how to use a function, and how to replace classes with them for developed coders, another time. This will show you the basics to functions. Code: <?php function repeatString($string, $times) // you can use what ever variables you want, and however many you want. { $count = 0; while($count < $times) { echo"\n $string"; $count += 1; } } ?> Blah blah blah... <?php repeatString("Hello!", 10); // this will echo "Hello!" 10 times ?> returning variables Code: <?php function 50Chance() { $rand = rand(0, 1); return $rand; ] ?> blah blah blah... <?php 50Chance(); ?> //conditional functions <?php function ifGreaterThan0($num); { if($num > 0) { return 1; } else { return 0; } } ?> A Noobs World © 2007-2008 |
|
 |
|
No reactions yet.
Please login or sign up to rate this intel.
Please login or sign up to add a comment.
The copyright for this content entitled "Tut: Basic Functions with PHP" has been specified by the contributor as:
All Rights Reserved
This content may not be copied, distributed or adapted by anyone under any circumstances.
|
 |
|
This intel was contributed by hotnoob
|
May, 2012
2008
January, February, March, April, May, June, July, August, September, October, November, December
2009
January, February, March, April, May, June, July, August, September, October, November, December
2010
January, February, March, April, May, June, July, August, September, October, November, December
2011
January, February, March, April, May, June, July, August, September, October, November, December
2012
January, February, March, April, May
|
|
Not a member yet?
Qondio is a powerful network for making it online. If you have a website to
promote, we can help.
Sign up and get in on the action.
|
|
Welcome to Qondio! Discover the awesome power this network can deliver by going to our About page. Or you could skip straight to the Sign Up form.
|
|