Current Location: Home> Function Categories> fputs

fputs

alias for fwrite
Name:fputs
Category:File system
Programming Language:php
One-line Description:The alias for fwrite().

Definition and usage

The fputs() function is written to a file (safely used in binary files).

fputs() function is an alias for the fwrite() function.

Example

 <?php
$file = fopen ( "test.txt" , "w" ) ;
echo fputs ( $file , "Hello World. Testing!" ) ;
fclose ( $file ) ;
?>

Output:

 twenty one

grammar

 fputs ( file , string , length )
parameter describe
file Required. Specifies the open file to be written.
string Required. Specifies the string to be written to the file.
length Optional. Specifies the maximum number of bytes to be written.

illustrate

fwrite() writes the contents of string to the file pointer file . If length is specified, the writing will stop when length bytes are written or string is finished, depending on which situation is encountered first.

fwrite() returns the number of characters written, and returns false when an error occurs.

Similar Functions
  • Read the entire file into an array file

    file

    Readtheentirefileint
  • Obtain file permissions fileperms

    fileperms

    Obtainfilepermission
  • Give information about a file or symbol connection lstat

    lstat

    Giveinformationabout
  • Change file mode chmod

    chmod

    Changefilemode
  • Read a line from a file pointer fgets

    fgets

    Readalinefromafilepo
  • Read a line from a file pointer and filter out HTML tags fgetss

    fgetss

    Readalinefromafilepo
  • Returns the location where the file pointer is read/write ftell

    ftell

    Returnsthelocationwh
  • Read a line from the file pointer and parse the CSV field fgetcsv

    fgetcsv

    Readalinefromthefile
Popular Articles