Memory App
Programming
 




printf()

<?php
    printf ("The string is %s %s", "abc", "def"); 
        // The string is abc def
sprint()

<?php
    echo $a = sprintf("The number is %d", "123"); 
        // The number is 123
vsprintf()

<?php
    echo vsprintf("The string is %s %s", array("abc", "def"));
        // The string is abc def
        // Operates as sprintf() but accepts an array of arguments,
fprintf()

<?php
    // write a formatted string to a stream

    if ($fd = fopen('date.txt', 'w')) {
        fprintf($fd, "%s-%s-%s", $y, $m, $d);
    }
sscanf()

<?php
    // 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



Top Reference > Programming
0/0 (80)  
Not Logged