posix_mknod

FunctionParams and return types changed in PHP 8.0

Create a special or ordinary file (POSIX.1).

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

posix_mknod Function synopsis

posix_mknod(
    string $filename,
    int $flags,
    int $major = 0,
    int $minor = 0
  ): bool

Parameters

$filename

Typestring

The file to create

$flags

Typeint

This parameter is constructed by a bitwise OR between file type (one of the following constants: POSIX_S_IFREG, POSIX_S_IFCHR, POSIX_S_IFBLK, POSIX_S_IFIFO or POSIX_S_IFSOCK) and permissions.

$flags accepts one of the following constant values:

$major

OptionalTypeintDefault value0

The major device kernel identifier (required to pass when using S_IFCHR or S_IFBLK).

$minor

OptionalTypeintDefault value0

The minor device kernel identifier.

Return value

Typebool

Returns true on success, false on failure

Changes to the posix_mknod Function

PHP 8.0

  • Return type added: bool
  • Parameter name of parameter #1 changed: $pathname to $filename
  • Parameter type added for parameter #1 ($filename): string
  • Parameter name of parameter #2 changed: $mode to $flags
  • Parameter type added for parameter #2 ($flags): int
  • Parameter type added for parameter #3 ($major): int
  • Parameter default value added for position #3 ($major): 0
  • Parameter type added for parameter #4 ($minor): int
  • Parameter default value added for position #4 ($minor): 0
  posix_mknod(
-     $pathname,
+     string $filename,
-     $mode,
+     int $flags,
-     $major,
+     int $major = 0,
-     $minor
+     int $minor = 0
-   )
+   ): bool

posix_mknod Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes
PHP 8.5Supported (Latest) Yes
PHP 8.4Supported Yes
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes