pendejo

  • String to integer (strip all non numerics) with PHP

    I’ve been hacking somebody else’s CMS (without access to the main engine) and needed to calculate a mathematical function on some prices. Specifically needed to display a percentage drop when given an original price as well as the current price. Here follows the journey. [Jump to The Solution.] Easy right? <?php if($originalPrice > 0) {…