- 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() {
return printf("Hello! My name is %s, I am %d years old and it is $genderCheck that I am a male.", $this->string, $this->int, ($this->bool == true ? "true" : "false"));
}
}
$instance = new Example();
echo $instance->printDetails();
?>