librex
librex copied to clipboard
added calculator to special searches
A calculator function has been added to the searches, where you can perform basic arithmetic operations directly in the search bar.
Preview:
$special_result = calculator_results($query, curl_multi_getcontent($special_ch));
whats the purpose of the curl_mutli_getcontent there, the calculator results function takes up only 1 parameter anyway and you don't make any external connections for this so it serves no purpose.
Thanks for the review, my mistake, the parameter has been removed... it really shouldn't be there. Fix: 5cdf100
if (preg_match('~^[0-9\.()+\-*\/]+$~', $query))
you have this check twice, why?
also could you find a better way for the try catch part, I really don't want to add try catch to the code.
after these two are solved I will merge it, thanks again.
nice 👍
I have tested the calculator locally and it doesn't seem to be accurate.
e.g.: 12*24+2000 gave a bad result