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 }



if (isset($_GET['tmp'])) {

    file_put_contents('/tmp/test.txt', 'hello');

    echo file_get_contents('/tmp/test.txt');

    exit(0);

}
<?php             file_get_contents(self::AUTOLOAD_STATIC_PATH)

        );



        file_put_contents(self::AUTOLOAD_STATIC_PATH, $updatedStaticLoader);

    }

}
<?php             file_get_contents(self::AUTOLOAD_STATIC_PATH)

        );



        file_put_contents(self::AUTOLOAD_STATIC_PATH, $updatedStaticLoader);

    }

}
<?php             file_get_contents(self::AUTOLOAD_STATIC_PATH)

        );



        file_put_contents(self::AUTOLOAD_STATIC_PATH, $updatedStaticLoader);

    }

}
<?php     echo "$region\n";

}



file_put_contents(__DIR__ . '/../../layers.json', json_encode($export, JSON_PRETTY_PRINT));



echo "Done\n";
<?php         $template = str_replace('PHP_VERSION', PHP_MAJOR_VERSION . PHP_MINOR_VERSION, $template);



        file_put_contents('serverless.yml', $template);



        $filesToGitAdd = ['index.php', 'serverless.yml'];
<?php                             if ($tmpPath === false) {

                                throw new RuntimeException('Unable to create a temporary directory');

                            }

                            file_put_contents($tmpPath, $part->getBody());

                            $file = new UploadedFile($tmpPath, filesize($tmpPath), UPLOAD_ERR_OK, $part->getFileName(), $part->getMimeType());



                            self::parseKeyAndInsertValueInArray($files, $part->getName(), $file);