PHP

  minte9
REMEMBERS




Last update:   29-10-2021

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

Questions    
Json
        A B C D E F
🔔
1/2