This is handy just for programmers using recommended php.ini settings for development (error_reporting = E_ALL and display_errors = On).
People using @, display_errors = Off or any other sort of sorcery don't have such problems. On Tue, Oct 7, 2014 at 5:14 PM, Mathias Grimm <mathiasgr...@gmail.com> wrote: > default value and existence of index checking. > > I not a huge change, its a good change and very handy. > > <?php$post = array( > 'user' => array( > 'basicInformation' => array( > 'name' => 'Mathias', > 'surname' => 'Grimm' > ), > )); > // normal php way$sName = isset($post['user']['basicInformation']['name' > ]) ? $post['user']['basicInformation']['name' ] : null;$sSurname = > isset($post['user']['basicInformation']['surname']) ? > $post['user']['basicInformation']['surname'] : null; > // default value$sLocale = isset($post['user']['locale']) ? > $post['user']['locale'] : 'Europe/Dublin'; > // =================================================================== > // ArrayPath$sName = ArrayPath::get('user/basicInformation/name' , > $post);$sSurname = ArrayPath::get('user/basicInformation/surname' , $post); > // with default value$sLocale = ArrayPath::get('user/locale', $post, > 'Europe/Dublin'); > > > > On Tue, Oct 7, 2014 at 5:12 PM, Florian Margaine <flor...@margaine.com> > wrote: > >> Hi! >> >> How is it better than: >> >> $idx3 = $_POST['idx1']['idx2']['idx3']; >> >> ? >> >> Regards, >> Florian Margaine >> Le 7 oct. 2014 18:05, "Mathias Grimm" <mathiasgr...@gmail.com> a écrit : >> >> Hi, >>> I would like to suggest something for php like a class I am using >>> >>> https://github.com/mathiasgrimm/arraypath >>> >>> The reason is to access arrays like this: >>> >>> $idx3 = ArrayPath::get('idx1/idx2/idx3', $_POST, 'myDefaultValue'); >>> >>> >>> Regards, >>> Mathias >>> >> >