ini_key_exists

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

Syntax:

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


Description

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.


Example:

ini_open('savedata.ini');
if !ini_key_exists('save1', 'name')
   {
   global.name = 'Player1';
   }
ini_close();

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


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