Current Location: Home> Function Categories> fileperms

fileperms

Obtain file permissions
Name:fileperms
Category:File system
Programming Language:php
One-line Description:Returns permissions to the file.

Example

Example 1

 <span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token keyword">echo</span> <span class="token function">fileperms</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"test.txt"</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

Output:

 33206

Example 2

Return permissions as octal values:

 <span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token keyword">echo</span> <span class="token function">substr</span> <span class="token punctuation">(</span> <span class="token function">sprintf</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"%o"</span> <span class="token punctuation">,</span> <span class="token function">fileperms</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"test.txt"</span> <span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">,</span> <span class="token operator">-</span> <span class="token number">4</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

Output:

 1777
Similar Functions
  • Determine whether the given file name is a normal file is_file

    is_file

    Determinewhethertheg
  • alias for fwrite fputs

    fputs

    aliasforfwrite
  • Write to files (safely used in binary files) fwrite

    fwrite

    Writetofiles(safelyu
  • Return to the directory part in the path dirname

    dirname

    Returntothedirectory
  • Parse a configuration file parse_ini_file

    parse_ini_file

    Parseaconfigurationf
  • Returns the normalized absolute path name realpath

    realpath

    Returnsthenormalized
  • Close an open file pointer fclose

    fclose

    Closeanopenfilepoint
  • Format input from a file fscanf

    fscanf

    Formatinputfromafile
Popular Articles