How To: Create a PHP Function and use it

Published: 10 August 2011
on channel: debuggify
1,640
2

//how to create a function and use it with php

//first declare it.

//begin
function name_of_the_function($entering_variable){

//code
if($entering_variable == 'Something...'){
//entering variable must equal the provided text otherwise the else statment is executed.
$exit_variable = true;
}else{
//this code will execute only if the if statement is false, the variable does not equal the provided string.
$exit_variable = false;
}

//end
return $exit_variable;
}

//to use it:

//call the function
name_of_the_function('Items to pass');

//this will show: nothing.

//call the function
print name_of_the_function('Items to pass');

//this will show: nothing.


if(name_of_the_function('Items to pass')){
//if name_of_the_function('Items to pass') is true than
print 'OK Good! print this! the function returns true.';
}else{
//if name_of_the_function('Items to pass') is false than
print 'seems like the function returned false.';
}


On this page of the site you can watch the video online How To: Create a PHP Function and use it with a duration of hours minute second in good quality, which was uploaded by the user debuggify 10 August 2011, share the link with friends and acquaintances, this video has already been watched 1,640 times on youtube and it was liked by 2 viewers. Enjoy your viewing!