Special functions in PHP

Lets discuss some special functions in PHP. In PHP, we can able TO define some special functions that will be called automatically. Those functions not required function call to execute the code inside these functions.

  1. Die()
  2. Sleep()
  3. Var_dump()
  4. Print_r()
  5. Exit


  • Inbuilt php function.
  • Prints the message and terminate the php script.
  • It accepts only single parameter and which is not mandatory to be passed .

Syntax : die($message);


  • Inbuilt php function.
  • It accepts only single parameter and which is mandatory to be passed.
  • Used to delay the execution of the program for given number of seconds.
  • It returns zero on success, or FALSE on error. This function returns a non-zero value if the call was interrupted by a signal.

Syntax : int sleep(int $seconds)


  • Inbuilt php function.
  • dumps information about one or more variables.
  • includes the data type and value of the variable.
  • In case of string, it also includes the size of the string passed inside the function.
  • The array and object are explored recursively with values to show their structure.

Syntax: var_dump(var1, var2, …);

  • Inbuilt php function.
  • displays information about a variable in a human-readable way.
  • It shows the information stored in a variable, which is easily understandable to the user.
  • Used to print an array.

Syntax : print_r(variable);


  • Inbuilt php function.
  • terminates the execution of the script.
  • The shutdown functions and object destructors will always be executed even if exit() function is called.
  • act as an alias of the die() function.

Syntax :  exit(message);

Posts created 494

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top