php

Exploring the Most Useful and Popular Predefined Functions in PHP

Built in functions are predefined functions in PHP.
These PHP inbuilt functions are what make PHP a very efficient and productive scripting language.
The built in functions of PHP can be classified and here are the top PHP Functions you must know before you start working as a PHP below.

The following functions are the PHP functions that you will be using day-to-day and it’s generated by my experience of developing with PHP.

<?php
echo() – Output one or more strings variable. 
print() or print_r() – Output a string and Prints human-readable information about a variable
exit() – Output a message and terminate the current script
phpinfo() – Outputs information about PHP’s configuration
require() or require_once() – require() includes and evaluates a specific file, while require_once() does that only if it has not been included before
isset() – Determine if a variable is declared and is different than NULL
count() – Count all elements in an array, or something in an object
explode() – Split a string by a string
implode() – Join array elements with a string
rand() – Generate a random integer
is_array() – Finds whether a variable is an array
array_push() – Push one or more elements onto the end of array
round() – Rounds a float
trim() – Strip whitespace (or other characters) from the beginning and end of a string
substr() – Return part of a string
str_replace() – Replace all occurrences of the search string with the replacement string
stripos() – Find the position of the first occurrence of a case-insensitive substring in a string
strlen() – Get string length
strtolower() or strtoupper() – Make a string lowercase and make a string uppercase
date() – Format a local time/date
strtotime() – Parse about any English textual DateTime description into a Unix timestamp
error_reporting() – Sets which PHP errors are reported
htmlspecialchars() – Convert special characters to HTML entities
json_decode() – Decodes a JSON string
json_encode() – Returns the JSON representation of a value
?>

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button