Php Levantar variables beta 0.1


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



Copy this code and paste it in your HTML
  1. define("INT",0,1);
  2. define("VARCHAR",1,1);
  3. define("TEXT",2,1);
  4. #Ejemplos:
  5. #echo levantar($_GET["variable"], varchar, 'hola');
  6. #$variable = levantar($_GET["variable"], int, 0 );
  7. function levantar(&$str,$tipo=1,$default='',$upper=0){
  8. $return = '';
  9. if(isset($str)):
  10. if($tipo==1):
  11. $return = limpiar($str);
  12. elseif($tipo==2):
  13. $return = limpiarHTML($str);
  14. else:
  15. $return = intval($str);
  16. endif;
  17. else:
  18. $return = ($tipo==0) ? (is_numeric($default)) ? $default : 0 : $default;
  19. endif;
  20.  
  21.  
  22.  
  23. return $return;
  24. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.