This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (November 2018)

Functions in PHP are like the custom blocks in Scratch, they allow the developer to easily call back the same code multiple times, and using arguments, it can even be with different values.

Defining a Function

This is a custom block in Scratch:

define my custom block (value1) (value2)
...

This is how a function is defined in PHP:

<?php
    function myFunction($value1, $value2){
        // code goes here
    }
?>

Cookies help us deliver our services. By using our services, you agree to our use of cookies.