file_put_contents

Supported Versions: PHP 5, PHP 7, PHP 8
Write data to a file
<?php file_put_contents(    string $filename,    mixed $data,    int $flags = 0,    ?resource $context = null): int|false
<?php             $data['defects'][$test] = $status->asInt();

        }



        file_put_contents(

            $this->cacheFilename,

            json_encode($data),

            LOCK_EX

        );

    }
<?php             mkdir(dirname($snapshotFilename), 0755, true);

        }



        file_put_contents($snapshotFilename, $snapshot);



        return str_replace(dirname($this->testsPath).'/', '', $snapshotFilename);

    }
<?php });



test('deletes file after all', function () use ($file) {

    file_put_contents($file, 'foo');

    $this->assertFileExists($file);

    register_shutdown_function(function () {
<?php         array_pop($outputContent);

        array_pop($outputContent);



        file_put_contents($snapshot, implode("\n", $outputContent));

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

        $output = explode("\n", $output());

        array_pop($output);
<?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));

    }