Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Binary-safe file write
Alias fputs
<?php fwrite(resource $stream, string $data, ?int $length = null): int|false
<?php function write_line(string $line)

{

    fwrite(STDOUT, "{$line}\n");

}



function panic(string $reason)
<?php                 if (get_class($exception) !== $this->exceptionTypeToRetryOn) {

                    throw $exception;

                }

                fwrite(STDOUT, 'Retrying ...' . PHP_EOL);

                sleep($this->timeoutForExceptionRetry);

            }

        }
<?php function stream_with_contents(string $contents)

{

    $stream = fopen('php://temp', 'w+b');

    fwrite($stream, $contents);

    rewind($stream);



    return $stream;
<?php     {

        try {

            $writeStream = fopen('php://temp', 'w+b');

            fwrite($writeStream, $contents);

            rewind($writeStream);

            $this->writeStream($path, $writeStream, $config);

        } finally {
<?php     {


        $stream = fopen('php://temp', 'w+b');

        fwrite($stream, $this->contents);

        rewind($stream);



        return $stream;
<?php         break;

    } catch (Throwable $exception) {

        if (time() - $start < 30) {

            fwrite(STDOUT, "Exception while trying to connect:'\n");

            fwrite(STDOUT, (string) $exception);

            fwrite(STDOUT, "\n\n");

        }
<?php     } catch (Throwable $exception) {

        if (time() - $start < 30) {

            fwrite(STDOUT, "Exception while trying to connect:'\n");

            fwrite(STDOUT, (string) $exception);

            fwrite(STDOUT, "\n\n");

        }

        usleep(10000);
<?php         if (time() - $start < 30) {

            fwrite(STDOUT, "Exception while trying to connect:'\n");

            fwrite(STDOUT, (string) $exception);

            fwrite(STDOUT, "\n\n");

        }

        usleep(10000);

    }
<?php }



if ( ! $connected) {

    fwrite(STDERR, "Unable to start FTP server.\n");

    exit(1);

}
<?php     exit(1);

}



fwrite(STDOUT, "Detected FTP server successfully.\n");
<?php }



if ( ! $connected) {

    fwrite(STDERR, "Unable to start SFTP server.\n");

    exit(1);

}
<?php     exit(1);

}



fwrite(STDOUT, "Detected SFTP server successfully.\n");