SyntaxStudy
Sign Up
PHP Built-in Functions Overview
PHP Beginner 1 min read

Built-in Functions Overview

PHP Built-in Functions

PHP has 1000+ built-in functions. These are the most important categories.

Date & Time

  • date("Y-m-d")
  • time() — Unix timestamp
  • strtotime("next Monday")

File System

  • file_get_contents()
  • file_put_contents()

JSON

  • json_encode($arr)
  • json_decode($str, true)

Regular Expressions

  • preg_match($pattern, $str)
  • preg_replace($pattern, $replace, $str)
Example
<?php
// Date
echo date("Y-m-d H:i:s");        // 2025-05-01 14:30:00
echo date("l, F j, Y");          // Thursday, May 1, 2025

// JSON
$data = ["name"=>"Alice","age"=>25];
$json = json_encode($data);       // {"name":"Alice","age":25}
$back = json_decode($json, true); // back to array

// Regex
preg_match("/\d+/", "abc123def", $m);
echo $m[0]; // 123

$clean = preg_replace("/[^a-zA-Z0-9]/", "", "hello@world!");
echo $clean; // helloworld
?>