Phar::hasMetadata

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.2.0)

Phar::hasMetadataReturns whether phar has global meta-data

Descrição

public Phar::hasMetadata(): bool

Returns whether phar has global meta-data set.

Parâmetros

No parameters.

Valor Retornado

Returns true if meta-data has been set, and false if not.

Exemplos

Example #1 A Phar::hasMetadata() example

<?php
try {
    $phar = new Phar('myphar.phar');
    var_dump($phar->hasMetadata());
    $phar->setMetadata(array('thing' => 'hi'));
    var_dump($phar->hasMetadata());
    $phar->delMetadata();
    var_dump($phar->hasMetadata());
} catch (Exception $e) {
    // handle error
}
?>

O exemplo acima produzirá:

bool(false)
bool(true)
bool(false)

Veja Também