isset instead of strlen


/ Published in: PHP
Save to your folder(s)

This snippet uses isset() instead strlen() to verify a PHP variable (in this example $username) is set and is at least six characters long.


Copy this code and paste it in your HTML
  1. <?php
  2. if (isset($username[5])) {
  3. // Do something...
  4. }
  5. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.