PLZ: A handy PHP library for lazy programmers
  • Namespace
  • Class
  • Tree
  • Todo

Namespaces

  • amekusa
    • plz
  • PHP

Classes

  • alt
  • arr
  • constant
  • dom
  • fn
  • num
  • obj
  • op
  • path
  • str
  • sys
  • T
  • type
  • xml

Exceptions

  • ErrorException

Class path

Path utilities

To get started, place the following line around top of your code.

use amekusa\plz\path;
Abstract
Namespace: amekusa\plz
Located at path.php

Methods summary

public static
# normal( string $X, string $Separator = '/' )

Returns a normalized path

Returns a normalized path

Parameters

$X
Path to normalize
$Separator
['/'] Directory separator

Example

Absolute path

echo path::normal('/srv//http/example.com///');
/srv/http/example.com/

Relative path

echo path::normal('images//favicon.svg');
images/favicon.svg

Normalize to slash

echo path::normal('xxx\yyy\zzz');
xxx/yyy/zzz

Normalize to backslash

echo path::normal('xxx/yyy/zzz', '\\');
xxx\yyy\zzz

public static string
# ext( string $X )

Returns the extension of a file path

Returns the extension of a file path

Parameters

$X
A file path

Returns

string
The extension of $X

Example

Demonstration

echo path::ext('choosy-developers-choose.gif');
.gif

public static
# join( array|string* $Paths )

Returns a single path that is concatenated with supplied paths

Returns a single path that is concatenated with supplied paths

Parameters

$Paths
Pieces of a path

Example

Demonstration

echo path::join('/srv', 'http/', '/example.com');
/srv/http/example.com

Passing an array

echo path::join(array ('/srv', 'http', 'example.com'));
/srv/http/example.com

public static
# join_with( $Separator, $Paths )
PLZ: A handy PHP library for lazy programmers API documentation generated by ApiGen