Guest User

Untitled

a guest
May 30th, 2011
162
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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};
RAW Paste Data