- printf: documentation ( source)
<?php
class Example {
private $string;
private $int;
private $bool;
function __construct() {
$this->string = "Nabir";
$this->int = 19;
$this->bool = true;
}
function printDetails() {
printf("Hello, my name is %s, I am %d years old and it is %b true that I am a male.", $this->string, $this->int, $this->bool);
}
}
$instance = new Example();
echo $instance->printDetails();
?>