User Tools

Site Tools


docs:tips_n_tricks:php.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
docs:tips_n_tricks:php.html [08.03.2012 10:04 CET] peterdocs:tips_n_tricks:php.html [08.03.2012 10:23 CET] (current) peter
Line 87: Line 87:
     print '+-----------' ;     print '+-----------' ;
     print "+\n";     print "+\n";
 +
 +or
 +
 +  <?
 +    print "PHP Version is ".phpversion()."\n";
 +    
 +    print '+-------------------';
 +    print '+-----------' ;
 +    print '+-----------' ;
 +    print "+\n";
 +  
 +    print '| value             ';
 +    print '| isset()   ' ;
 +    print '| empty()   ' ;
 +    print "|\n";
 +  
 +    print '+-------------------';
 +    print '+-----------' ;
 +    print '+-----------' ;
 +    print "+\n";
 +  
 +    printf('| $foobar   %-7s | %-9s | %-9s |'."\n",''       ,(isset($foobar) ? '' : 'not ').'set',(empty($foobar) ? '' : 'not ').'empty' );
 +  
 +    $foobar = 0;
 +    printf('| $foobar = %-7s | %-9s | %-9s |'."\n",'0'      ,(isset($foobar) ? '' : 'not ').'set',(empty($foobar) ? '' : 'not ').'empty' );
 +  
 +    $foobar = "";
 +    printf('| $foobar = %-7s | %-9s | %-9s |'."\n",'""'     ,(isset($foobar) ? '' : 'not ').'set',(empty($foobar) ? '' : 'not ').'empty' );
 +  
 +    $foobar = 42;
 +    printf('| $foobar = %-7s | %-9s | %-9s |'."\n",'42'     ,(isset($foobar) ? '' : 'not ').'set',(empty($foobar) ? '' : 'not ').'empty' );
 +      $foobar = "42";
 +    printf('| $foobar = %-7s | %-9s | %-9s |'."\n",'"42"'   ,(isset($foobar) ? '' : 'not ').'set',(empty($foobar) ? '' : 'not ').'empty' );
 +  
 +    $foobar = "x";
 +    printf('| $foobar = %-7s | %-9s | %-9s |'."\n",'"x"'    ,(isset($foobar) ? '' : 'not ').'set',(empty($foobar) ? '' : 'not ').'empty' );
 +  
 +    $foobar = array();
 +    printf('| $foobar = %-7s | %-9s | %-9s |'."\n",'array()',(isset($foobar) ? '' : 'not ').'set',(empty($foobar) ? '' : 'not ').'empty' );
 +  
 +    $foobar = NULL;
 +    printf('| $foobar = %-7s | %-9s | %-9s |'."\n",'NULL'   ,(isset($foobar) ? '' : 'not ').'set',(empty($foobar) ? '' : 'not ').'empty' );
 +  
 +    print '+-------------------';
 +    print '+-----------' ;
 +    print '+-----------' ;
 +    print "+\n";
 +
  
  
docs/tips_n_tricks/php.html.txt · Last modified: 08.03.2012 10:23 CET by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki