How to calculate the result of a mathematical expression given as a string: function calc_string( $mathString ) { $cf_DoCalc = create_function("", "return (" . $mathString . ");" ); return $cf_DoCalc(); } echo "result is: "calc_string("2+25*3"); //result is: 77
Tag: parse
It is very easy to parse XML in CakePHP , here is an example in CakePHP v2 // import XML Utility class App::uses('Xml', 'Utility'); // your XML file's location $xml1 = Xml::build('http://url-of-XML'); $xml2 = Xml::build('http://http://url-of-XML', array('return' => 'simplexml')); // $xml now is a instance of SimpleXMLElement // New method using DOMDocument $xml3 = Xml::build('http://url-of-XML', array('return' … Continue reading Parsing XML easily in CakePHP 2