you can do something like

if !$ini(file.ini,Section,data2) { echo -a data2 doesn't exist }