Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

PHP sscanf — Parses input from a string according to a format

<?php
// getting the serial number
list($serial) = sscanf("SN/2350001", "SN/%d");
// and the date of manufacturing
$mandate = "January 01 2000";
list($month, $day, $year) = sscanf($mandate, "%s %d %d");
echo "Item $serial was manufactured on: $year-" . substr($month, 0, 3) . "-$day
";
?>
 
PREVIOUS NEXT
Tagged: #PHP #sscanf #Parses #input #string #format
ADD COMMENT
Topic
Name
2+7 =