Returns whether or not a key in an open .ini file exists.


ini_key_exists(section, key);

Argument Description
section The section in the open .ini file to check a key in.
key The key to check for.

Returns: N/A


This function checks to see if a key exists in the currently open ini. This is not a necessary check to prevent errors as, when a key does not exist, reading from a non-existent key will just return a defaulted value. It can be useful to see if an ini file has saved specific data and a few other things, however.


if !ini_key_exists('save1', 'name')
   { = 'Player1';

This will set variable to 'Player1' if no such key as "name" exists.

Back: Ini Files
Next: ini_section_exists
© Copyright YoYo Games Ltd. 2018 All Rights Reserved