Posts Tagged with "good practices"
Responsive website Vs standalone mobile version
Posted by Stanislav Furman on June 16, 2014Important things you must know before register a domain name
Posted by Stanislav Furman on May 16, 2014Backward version compatibility in PHP web application
Posted by Stanislav Furman on February 17, 2014Loose comparison in PHP. Example of breakable functionality.
Posted by Stanislav Furman on September 12, 2013Cookieless cookies and user authentication without cookies and JavaScript
Posted by Stanislav Furman on September 9, 2013Wow! Such an interesting thing I just found.
There is another way of tracking users without using cookies / javascript that only few people know of. Check this link to get more details.
How to protect against SQL injection, and why SQL injection is dangerous
Posted by Stanislav Furman on May 14, 2013How to trim array elements in PHP in one shot
Posted by Stanislav Furman on April 17, 2013If you are looking for a method to trim leading and trailing white spaces in all elements of a PHP array, you could use the following code:
<?php // custom function to trim value function _trim(&$value) { $value = trim($value); } $data = array(' a ',' b',' c d '); array_walk($data,"_trim"); var_dump($data); /* Output: array (size=3) 0 => string 'a' (length=1) 1 => string 'b' (length=1) 2 => string 'c d' (length=5) */
This works, but might look a little long. If you want a shorter solution, here it is:
Continue reading