pastebin

Paste Search Dynamic
Recent pastes
where
  1. <?php
  2.  
  3. $params = array('name' => 'Shyam', 'dateOfBirth' => '');
  4.  
  5. $where = '';
  6.  
  7. foreach ($params as $key => $param) {
  8.         if (!empty($param)) {
  9.                 if (!empty($where)) {
  10.                         $where .= " AND ";
  11.                 }
  12.                 $where .= "{$key} = '{$param}'";
  13.         }
  14. }
  15.  
  16. echo $where;
  17.  
  18.  
  19. ?>
Parsed in 0.011 seconds