php8.5
Home/ Manual/ rpminfo / functions/ rpmexpand

rpmexpand

PHP function Edit on GitHub ✎

(PECL rpminfo >= 1.2.0)

Retrieve expanded value of a RPM macro

Description

rpmexpand(string $text): string

Retrieve expanded value of a RPM macro.

Parameters

text

Text with RPM macros to expand.

Return Values

A string with concatenated macro expansions.

Examples

A rpmexpand() example

php
<?php
$distro = rpmexpand("%{?fedora:Fedora %{fedora}}%{?rhel:Enterprise Linux %{rhel}}");
print_r($distro);
?>

The above example will output:

output
Fedora 41

See Also

Source: reference/rpminfo/functions/rpmexpand.xml · from the official PHP manual (php/doc-en)