file_get_contents

Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Reads entire file into a string
<?php file_get_contents(    string $filename,    bool $use_include_path = false,    ?resource $context = null,    int $offset = 0,    ?int $length = null): string|false
<?php     public function load(): void

    {

        $contents = @file_get_contents($this->cacheFilename);



        if ($contents === false) {

            return;
<?php     {

        return Targeted::make(

            $this,

            fn (ObjectDescription $object): bool => str_contains((string) file_get_contents($object->path), 'declare(strict_types=1);'),

            'to use strict types',

            FileLineFinder::where(fn (string $line): bool => str_contains($line, '<?php')),

        );
<?php     {

        return Targeted::make(

            $this->original,

            fn (ObjectDescription $object): bool => ! str_contains((string) file_get_contents($object->path), 'declare(strict_types=1);'),

            'not to use strict types',

            FileLineFinder::where(fn (string $line): bool => str_contains($line, '<?php')),

        );
<?php                 continue;

            }



            $contents = file_get_contents($testresultFile->getPathname());

            assert($contents !== false);

            $testResult = unserialize($contents);

            assert($testResult instanceof TestResult);
<?php     public function get(): array

    {

        $contents = file_get_contents($snapshotFilename = $this->getSnapshotFilename());



        if ($contents === false) {

            throw ShouldNotHappen::fromMessage('Snapshot file could not be read.');
<?php     $process->run();



    $rawXmlContent = file_get_contents($junitLogFile);

    unlink($junitLogFile);
<?php $snapshot = function ($name) {

    $testsPath = dirname(__DIR__);



    return file_get_contents(implode(DIRECTORY_SEPARATOR, [

        $testsPath,

        '.snapshots',

        "$name.txt",

    ]));

};



test('allows to run a single test', function () use ($run, $snapshot) {
<?php         array_pop($output);

        array_pop($output);



        expect(implode("\n", $output))->toContain(file_get_contents($snapshot));

    }

})->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'))

    ->skipOnWindows();
<?php     if (getenv('REBUILD_SNAPSHOTS')) {

        file_put_contents($snapshot, normalize_windows_os_output($output()));

    } elseif (! getenv('EXCLUDE')) {

        expect(normalize_windows_os_output($output()))->toEqual(file_get_contents($snapshot));

    }

})->with([

    'Failure.php',
<?php $snapshot = function ($name) {

    $testsPath = dirname(__DIR__);



    return file_get_contents(implode(DIRECTORY_SEPARATOR, [

        $testsPath,

        '.snapshots',

        "$name.txt",

    ]));

};



test('todos', function () use ($run, $snapshot) {