Advertisement
Guest User

Untitled

a guest
May 30th, 2011
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. <?php
  2. $numbers = array(5, 19, 45, 6, 7, 21);
  3. $operators = array('*', '+', '-', '*', '+');
  4.  
  5. $mathString = '';
  6. foreach ($numbers as $key => $value) {
  7.     $mathString .= $value;
  8.     if ($key < count($operators)) {
  9.         $mathString .= $operators[$key];
  10.     }
  11. }
  12.  
  13. preg_match('/= ([0-9\.]+)/', file_get_contents('http://www.google.de/search?q='.urlencode($mathString)), $matches);
  14. echo $matches{1};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement