what is built in function in php ? and whts the difference of it with user defined functions? i think isset, unset, gettype,settype, strlen, strpos etc are built in function and when we write a function like this > function name{} that is user defined ? im little bit confused about this, please help me boss.

4 Years
Discussion Span
Last Post by diafol

Yep, things like isset is an inbuilt function that can be called at any time. A user defined function is something that MUST be set manually like this:


    function MyName()
        echo 'My Name is AHarrisGsy';


You would then call it like this:


Which should (providing it is done correctly), echo the words: "My Name is AHarrisGsy"

Good luck, I hope this helps and happy coding!


As a rule functions will return a value. It is up to the calling code what to do with that value.


function welcome($name){
    return "my name is $name";

echo welcome('diafol'); //prints: my name is diafol

$sentence = welcome('diawl');
echo "I live in Hell and $sentence"; //prints: I live in Hell and my name is diawl

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.