class Foo
{
private static $instance;
private function __construct()
{
}
public static function getInstance()
{
if (self::$insrance === null)
{
self::$insrance = new Foo();
return self::$instance;
}
return self::instance;
}
}
use DiDom\Document;
...
$document = new Document($html);
$elements = $documents->xpath('//*[text()="foo"]');
var_dump($elements);
$name = 'Vasya';
// выведет "My name is $name"
echo 'My name is $name';
// выведет "My name is Vasya"
echo "My name is $name";
echo sprintf('My name is %s', $name);