Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return part of a string
<?php substr(string $string, int $offset, ?int $length = null): string
<?php     public function setRoot(string $location = ''): PHPlater {

        if ($location && substr($location, -1) == '/') {

            throw new RuleBrokenError('Root must not end with slash. The template file should begin with it.');

        }

        $this->root = $location;
<?php         }



        $ext = $this->getExtension();

        $is_tpl_file = substr($data, -strlen($ext)) === $ext && str_contains($data, $ext);

        $location = $this->getRoot() . $data;

        if ($is_tpl_file) {

            $file_data = is_file($location) ? file_get_contents($location) : '';