No, you cannot directly use PHP in Twig.
There are several options:
Use PHP as a template engine
PHP . , PHP , PHP. . doc , .
Twig
Twig. AcmeTwigBundle, Twig. . doc , Symfony.
Twig 1.12 (Symfony2.2 ), , PHP :
new Twig_SimpleFilter('rot13', 'str_rot13');
rot13 Twig, str_rot13 PHP.