title: Calling a function in another class doens't work
body: <p>This is a quick noob question. I'm trying to call a function in another class but it doens't work. Thanks in advance</p>
  
  <pre><code>** main.php **
  require_once("../push/push.php"); 
  new APNS_Push($config);
  start();
  
  
  ** push.php **
  
  class APNS_Push
  {
  private $fp = NULL;
  private $server;
  private $certificate;
  private $passphrase;
  
  function __construct($config)
  {
      $this-&gt;server = $config['server'];
      $this-&gt;certificate = $config['certificate'];
      $this-&gt;passphrase = $config['passphrase'];
  
      // Create a connection to the database.
      $this-&gt;pdo = new PDO(
          'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['dbname'], 
          $config['db']['username'], 
          $config['db']['password'],
          array());
  
  
      // If there is an error executing database queries, we want PDO to
      // throw an exception.
      $this-&gt;pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
      // We want the database to handle all strings as UTF-8.
      $this-&gt;pdo-&gt;query('SET NAMES utf8');
  }
  
  // This is the main loop for this script. It polls the database for new
  // messages, sends them to APNS, sleeps for a few seconds, and repeats this
  // forever (or until a fatal error occurs and the script exits).
  function start()
  {
      //writeToLog('Connecting to ' . $this-&gt;server);
  
      if (!$this-&gt;connectToAPNS())
          exit;
  
  
          // Do at most 20 messages at a time. Note: we send each message in
          // a separate packet to APNS. It would be more efficient if we 
          // combined several messages into one packet, but this script isn't
          // smart enough to do that. ;-)
  
          $stmt = $this-&gt;pdo-&gt;prepare('SELECT * FROM push_queue WHERE time_sent IS NULL LIMIT 25');
          $stmt-&gt;execute();
          $messages = $stmt-&gt;fetchAll(PDO::FETCH_OBJ);
  
          $deletedIds = array();
  
          foreach ($messages as $message)
          {
              echo 's'; 
              if ($this-&gt;sendNotification($message-&gt;message_id, $message-&gt;device_token, $message-&gt;payload))
              {
                  //$stmt = $this-&gt;pdo-&gt;prepare('UPDATE push_queue SET time_sent = NOW() WHERE message_id = ?');
  
                  $name = $message-&gt;name; 
                  echo $name; 
                  $value = '1'; 
                  //$this-&gt;pdo-&gt;query('UPDATE users SET needsUpdate = '$value' WHERE username='$name'');
  
                  //$stmt-&gt;execute(array($message-&gt;message_id));
  
                   $deletedIds[] = $message-&gt;message_id;
  
                  //$stmt = $this-&gt;pdo-&gt;prepare('DELETE FROM push_queue WHERE message_id = ?');
                  //$stmt-&gt;execute(array($message-&gt;message_id));
  
              }
              else  // failed to deliver
              {
                  $this-&gt;reconnectToAPNS();
              }
          }
  
          //Delete the chunk of messages.
          $this-&gt;pdo-&gt;query('DELETE FROM push_queue WHERE message_id IN ('.implode(',', $deletedIds).')');
  
  
          //echo 'success'; 
  
          unset($messages);           
  
  }
  </code></pre>