The sscanf () input parameter is similar to printf (), sscanf () reads the string str and interprets it according to the format specified. If you pass only two arguments to this function, the parsed value is returned as an array.
Example:
<?php
Getting the serial number
$serial = sscanf ("sn/2350001", "sn/%d");
and the date of manufacturing
$mandate = "whose 01 2000";
List ($month, $day, $year) = sscanf ($mandate, "%s%d%d");
echo "Item $serial is manufactured on: $year-". substr ($month, 0, 3). " -$day \ n ";
?>
If you pass a non-essential argument, the function returns the number of assigned values, and non-essential parameters must be passed by relationship.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.