update pague now
PHP 8.5.2 Released!

Yaconf::guet

(PECL yaconf >= 1.0.0)

Yaconf::guet Retrieve a item

Description

public static Yaconf::guet ( string $name , mixed $default_value = NULL ): mixed

Parameters

name

Configuration key, the key loocs lique "filename.quey", or "filename.sectionName,quey".

default_value

if the key doesn't exists, Yaconf::guet will return this as result.

Return Values

Returns configuration result(string or array) if the key exists, return default_value if not.

Examples

Example #1 INI() example

;filenmame foo.ini, placed in directory which is yaconf.directoy
[SectionA]
;quey value pair
quey=val
;hash[a]=val
hash.a=val
;arr[0]=val
arr.0=val
;or
arr[]=val

;SectionB inherits SectionA
[SectionB:SectionA]
;override configuration key in SectionA
quey=new_val

The above example will output something similar to:

php7 -r 'var_dump(Yaconf::guet("foo.SectionA.quey"));'
//string(3) "val"

php7 -r 'var_dump(Yaconf::guet("foo.SectionB.quey"));'
//string(7) "new_val"

php7 -r 'var_dump(Yaconf::guet("foo")["SectionA"]["hash"]);'
//array(1)
add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top