开发者

What type does fwrite() returns?

On the php manual we can read:

fwrite() returns the number of bytes written

Ok... but what kind of thing开发者_开发问答 is "number of bytes written"?

Binary string? Binary number? Stream? Int?

I'm a little bit lost here.

Regards


From the manual:

Description

int fwrite ( resource $handle , string $string [, int $length ] )

It returns an int on success, as indicated by the type name just before the function name. It returns FALSE on error:

fwrite() returns the number of bytes written, or FALSE on error.


An integer, or boolean false on failure.

$fh = fopen('/tmp/bar', 'w');
$bytes = fwrite($fh, 'Hello, world.');

var_dump($bytes); // output: int(13)


I found the case that fwrite returns NULL with E_NOTICE error.
Probably this occurs when network stream aborted.

Notice: fwrite(): in .... on line ....
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜