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             $maps = array_merge($maps, static::createMap($dir));

        }



        file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));

    }
<?php             $tempFileName = $this->root . $file . uniqid('.', true) . '.tmp';

            try {

                return file_put_contents($tempFileName, $contents) !== false && rename($tempFileName, $this->root . $file);

            } catch (\ErrorException $e) {

                $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);

                if (Preg::isMatch('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
<?php             && !file_exists($configFile)

            && realpath(getcwd()) === realpath($this->config->get('home'))

        ) {

            file_put_contents($configFile, "{\n}\n");

        }



        $this->configFile = new JsonFile($configFile, null, $io);
<?php             }

        }



        file_put_contents($ignoreFile, $contents . $vendor. "\n");

    }
<?php         $status = $install->run();

        if ($status !== 0) {

            $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');

            file_put_contents($jsonFile->getPath(), $composerBackup);

        }



        if (!$dryRun) {
<?php         }



        $this->newlyCreated = !file_exists($this->file);

        if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {

            $io->writeError('<error>'.$this->file.' could not be created.</error>');



            return 1;
<?php         }



        if (filesize($this->file) === 0) {

            file_put_contents($this->file, "{\n}\n");

        }



        $this->json = new JsonFile($this->file);
<?php         $manipulator->removeMainKeyIfEmpty($removeKey);



        file_put_contents($json->getPath(), $manipulator->getContents());



        return true;

    }
<?php                 $msg = ' and '.$this->lock.' to their ';

            }

            $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.$msg.'original content.</error>');

            file_put_contents($this->json->getPath(), $this->composerBackup);

            if ($this->lockBackup) {

                file_put_contents($this->lock, $this->lockBackup);

            }
<?php             $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.$msg.'original content.</error>');

            file_put_contents($this->json->getPath(), $this->composerBackup);

            if ($this->lockBackup) {

                file_put_contents($this->lock, $this->lockBackup);

            }

        }
<?php             $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');

            if (!file_exists($sigFile)) {

                file_put_contents(

                    $home.'/keys.dev.pub',

                    <<<DEVPUBKEY

-----BEGIN PUBLIC KEY-----

MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f

FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi

i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A

hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f

o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk

8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn

8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf

TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9

pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72

8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4

r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE

wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==

-----END PUBLIC KEY-----

DEVPUBKEY

                );



                file_put_contents(

                    $home.'/keys.tags.pub',
<?php DEVPUBKEY

                );



                file_put_contents(

                    $home.'/keys.tags.pub',

                    <<<TAGSPUBKEY

-----BEGIN PUBLIC KEY-----

MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2

MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh

vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO

bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M

mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf

noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM

nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ

rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr

RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK

tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e

TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95

RGv89BPD+2DLnJysngsvVaUCAwEAAQ==

-----END PUBLIC KEY-----

TAGSPUBKEY

                );

            }



            $pubkeyid = openssl_pkey_get_public($sigFile);
<?php                 }

            }

        }

        file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);

        $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));



        $tagsKey = '';
<?php                 }

            }

        }

        file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);

        $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));



        $io->write('Public keys stored in '.$config->get('home'));
<?php Wscript.Sleep(300)

EOT;



        file_put_contents($script, $vbs);

        exec('"'.$script.'"');

        @unlink($script);