php相当于C的fputc

I am wondering if there is an equivalent to C's fputc in PHP? I am trying to do the following C code in PHP:

fputc(0x10, fp);

more information on fputc: http://en.wikipedia.org/wiki/C_file_input/output#Writing_to_a_stream_using_fputc

Thanks

You can write the character code directly to the file:

fputs($fp, "\x10");
// or
fputs($fp, chr(16)); 
// or
fputs($fp, chr(hexdec(10)); 

PHP does not treat single characters as a special type. Buts, as PHP string is just an sequence of octects, there is no problem in writing this:

  fwrite(fp,"\x10");

You would have to open a file in binary mode and then use