Php program to print the string using defined function

A Php program to print the string using defined function. Using this program we can print the string in the output using defined function. A global variable is a variable that is defined outside of the function. Global variables are accessible from any point in the script, even within and outside of functions. As a result, while a global variable can be declared just like any other variable, it must be declared outside of the function definition.

define("inlarn", "Welcome to");

function sample()
echo inlarn;




Welcome to

What is defined function in php

A user-defined function’s declaration begins with the word function, followed by the name of the function you want to write, parenthesis (), and lastly your function’s code enclosed in curly brackets. The defined() function in PHP is a built-in function that tests whether a constant exists or not, in other words, whether it is defined. defined($constant name); bool defined($constant name); Parameter: As noted before and described below, this function only accepts one parameter.