Monthly Archives: January 2014
How to remove the last character in a string in PHP ?
How to remove the last character in a string in PHP ? You have a string, let’s say “1,2,3,4,5,6,7,8,” that is generated in a loop, and you want to remove the last comma that is occurred on the last position of the string, to obtain a string like this: “1,2,3,4,5,6,7,8”. 1st solution
1 2 3 |
$string = "1,2,3,4,5,6,7,8,"; $newString = rtrim($string, ","); echo $newString; //outputs "1,2,3,4,5,6,7,8" as a string |
1 2 3 |
$string = "1,2,3,4,5,6,7,8,"; $newString = trim($string, ","); echo $newString; //outputs "1,2,3,4,5,6,7,8" as a string |
2nd
PHP mysql_real_escape_string example
PHP mysql_real_escape_string example PHP mysql_real_escape_string is a measure to prevent hackers from attacking your mysql database and leaking out specific information. Normally account level information that would then be used further in their attack and hacking your website completely. There are other PHP functions that could be used to prevent XSS attacks or sql injections,
The best PHP CMS Framework comparison
The best PHP CMS Framework comparison Lets say you are thinking of starting a project, an e-commerce project at that. Probably want to sell some products or services online, doesn’t really matter, but will involve having a billing account of some sort and ability to capture payments directly online. Sounds really fun right? Now, most of
Finally Facebook unblocked my website
Finally Facebook unblocked my website If you are reading this page then chances are that you’ve search it due to being blocked by Facebook for posting your own website url. I myself have also been in the same situation where Facebook blocked my url but finally, after half a year, Facebook unblocked my site. Why
File backup script using cronjob
File backup script using cronjob Just before the New Years a visitor was inquiring about how can he backup his account files, not just to backup the mysql databases. Well the process itself is similar, not that hard really. You do however need to understand that you should have access to the zip or tar
PHP math operations and operators
PHP math operations and operators PHP is a very powerful language that can help you to perform mathematical operations really easy. Math expressions are made up of operators and operands. You can perform easy operations like adding, subtracting, multiplying or dividing with PHP. Even comparison operators can be used with this language (greater than, less