"Fossies" - the Fresh Open Source Software Archive

Member "4.6.1/composer/pimple/pimple/ext/pimple/tests/004.phpt" (8 Apr 2021, 545 Bytes) of package /linux/www/studip-4.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 --TEST--
    2 Test has/unset dim handlers
    3 --SKIPIF--
    4 <?php if (!extension_loaded("pimple")) print "skip"; ?>
    5 --FILE--
    6 <?php 
    7 $p = new Pimple\Container();
    8 $p[] = 42;
    9 var_dump($p[0]);
   10 unset($p[0]);
   11 var_dump($p[0]);
   12 $p['foo'] = 'bar';
   13 var_dump(isset($p['foo']));
   14 unset($p['foo']);
   15 try {
   16     var_dump($p['foo']);
   17     echo "Excpected exception";
   18 } catch (InvalidArgumentException $e) { }
   19 var_dump(isset($p['bar']));
   20 $p['bar'] = NULL;
   21 var_dump(isset($p['bar']));
   22 var_dump(empty($p['bar']));
   23 ?>
   24 --EXPECT--
   25 int(42)
   26 NULL
   27 bool(true)
   28 bool(false)
   29 bool(true)
   30 bool(true)