- BASICS
- Quotes
- Constants
- Control Structures
- Reference
- Number Systems
- VARIABLES
- Definition
- Variable Variable
- Exists
- Type Casting
- OPERATORS
- Aritmetic
- Bitwise
- String
- Comparison
- Logical
- FUNCTION
- Definition
- Anonymous
- Reference
- Variable Arguments
- ARRAY
- Basics
- Operations
- Create
- Search
- Modify
- Sort
- Storage
- STRING
- String Basics
- String Compare
- String Search
- String Replace
- String Format
- String Regexp
- String Parse
-
Formating
- Json
- STREAMS
- File Open
- Read File
- Read Csv
- File Contents
- Context
- Ob_start
- OOP
- Object Instantiation
- Class Constructor
- Interfaces, Abstract
- Resource Visibility
- Class Constants
- Namespaces
- HTTP
- Headers
- File Uploads
- Cookies
- Sessions
Formating
printf()
printf ("The string is %s %s", "abc", "def");
// The string is abc def
sprint()
$s = sprintf("The number is %d", "123");
echo $s; // The number is 123
vsprintf()
Operates as sprintf() but accepts an array of arguments.
$vs = vsprintf("The string is %s %s", array("abc", "def"));
echo $vs; // The string is abc def
sscanf()
Instead of formatting output, it allows you to parse formatted input.
list($serial) = sscanf("SN/331122", "SN/%d");
echo $serial; // 331122
list($month, $day, $year) = sscanf("January 01 2012", "%s %d %d");
echo "$month - $day - $year"; // January - 1 - 2012
Last update: 531 days ago