91
PHP String sscanf() Function
The sscanf() is predefined PHP function. It is used to return parses input from a string according to a format. If we will pass two parameters in the function, the data will be returned as an array.
Related Function:
- print(): It is used for output one or more strings.
- fprint() : It is used to write a formatted string to a stream.
Syntax:
Parameter | Description | Required/Optional |
---|---|---|
string | Specify the string to read. | Required |
format | Specify the format to use.
| Required |
arg1 | Specify first variable to store data | Optional |
arg2 | Specify second variable to store data | Optional |
arg++ | Specify third , fourth and so on. | arg++ |
Example 1
Output:
int(7)
Example 2
Output:
int(18) int(6)
Example 3
Output:
string(10) "tutoraspire"
Example 4
Output:
Array ( [0] => We [1] => are [2] => Learning [3] => PHP [4] => 7 )
Next TopicPHP String