Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $numbers = array(5, 19, 45, 6, 7, 21);
- $operators = array('*', '+', '-', '*', '+');
- $mathString = '';
- foreach ($numbers as $key => $value) {
- $mathString .= $value;
- if ($key < count($operators)) {
- $mathString .= $operators[$key];
- }
- }
- preg_match('/= ([0-9\.]+)/', file_get_contents('http://www.google.de/search?q='.urlencode($mathString)), $matches);
- echo $matches{1};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement