Basic Functions in PHP Programming Languages. This tutorial is for Basic Functions. Why functions are useful in php and also in other programming languages? Lets see how we can create functions and use a function with our page. Firstly let me know you a function is something which allows you to declare a block of code that we may want to reuse,we use more arguments which is sometimes refractive.
Code for basic structure for functions(Screenshot1):-
Code for Basic Structure for Functions In Php Screenshot1 |
<?php function MyName() { echo 'Mohammed'; } echo 'My name is <br>'; MyName(); ?>
Output (Screenshot2):-
Screenshot2 |
In this examples of basic structure of functions there is keyword “function” along with name of function i.e “MyName” and conditions in curly brackets. Since this example is basic so I am just showing you to echo out my name using functions. Then when we want to use functions we just had to call the function by name and conditions inside curly brackets are applied.
Now you need to think about it logically how you can use functions in your programs.
No comments:
Post a Comment
Thanks For Comment Will get you Soon..