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             throw new RuntimeException('Unable to write to process ID file.');

        }



        file_put_contents($this->path, json_encode(

            array_merge($this->read(), ['masterProcessId' => $masterProcessId]),

            JSON_PRETTY_PRINT

        ));

    }
<?php             throw new RuntimeException('Unable to write to process ID file.');

        }



        file_put_contents($this->path, json_encode(

            array_merge($this->read(), ['state' => $newState]),

            JSON_PRETTY_PRINT

        ));

    }
<?php             throw new RuntimeException('Unable to write to process ID file.');

        }



        file_put_contents($this->path, json_encode(

            array_merge($this->read(), [

                'masterProcessId' => $masterProcessId,

                'managerProcessId' => $managerProcessId,

            ]),

            JSON_PRETTY_PRINT

        ));

    }
<?php             throw new RuntimeException('Unable to write to process ID file.');

        }



        file_put_contents($this->path, json_encode(

            array_merge($this->read(), ['state' => $newState]),

            JSON_PRETTY_PRINT

        ));

    }