Small, short code snippets that other people may find useful. Do you have a good regex that you would like to share? Share it! Even better, the code can be commented on, and improved.
Moderator: General Moderators
protokol
Forum Contributor
Posts: 353 Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:
Post
by protokol » Sat Jan 08, 2005 3:35 pm
I tend to trim() everything that is posted in a form. So instead of using a foreach to go through each value, I do this:
Code: Select all
<?php
$_POST = array_map('trim', $_POST);
?>
Last edited by
protokol on Mon Jan 10, 2005 7:25 pm, edited 1 time in total.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Sat Jan 08, 2005 3:38 pm
Thats a nifty technique.. ill be sure to use it