how to define function in php
snippet in php

how to define function in php

user1056

<?php
function writeMsg() {
    echo "Hello world!";
}

writeMsg(); //call the function
?>

execute function php

user6877

function functionName() {
    //code to be executed;
}
functionName();