unexpected T_var, expected T_variable error line 14 of the class
Results 1 to 2 of 2

Thread: unexpected T_var, expected T_variable error line 14 of the class

  1. #1
    Senior Member
    Join Date
    Aug 2009
    Posts
    365

    unexpected T_var, expected T_variable error line 14 of the class

    The script worked before I tried to add the $pointer var and the changes to the class. The error is on line 14 on the required class which is the public var $validFlag = "" ; line. What I'm trying to do is get the returned htmlmessage out of the $pointer array.

    PHP Code:
    <?php
    require_once 'phoogle1.php';
    $map->setAPIKey("ABQIAAAA9Bwvj_jq9ffNHGrXz9VO7xQALgqu6nN6nANsf-df7YvO8yp53xT4EfomqwVsDae1dfRiXRIGSNS1cQ");

    $addr $_POST['q'];

    $addrArrayunserialize($addr);

    foreach(
    $addrArray as $key => $value){
           
        
    $map->addAddress($value);
         
    $pointer $map->addAddress($value);
         if(
    $map->validFlag=1){
            
    $html $map->validPoints[$pointer]['htmlMessage'];
         }else {
             
    $html $map->invalidPoints[$pointer]['htmlMessage'];
         }

    $map->printGoogleJS();
    }
    ?>
    For the class all I did was add the "public" on the vars $invalidPoints & $validPoints and add the var $validFlag = ""; And then in the addAddress class I added the $this->validFlag = 1 and $this->validFlag = 0, lines.

    ---------class-----
    PHP Code:
    class PhoogleMap{
        public var  
    $validFlag "";
         


    public        var 
    $validPoints = array();

    public        var 
    $invalidPoints = array();


        function 
    addAddress($address,$htmlMessage=null){
         if (!
    is_string($address)){
            die(
    "All Addresses must be passed as a string");
          }
       
    //$apiURL = "http://api.local.yahoo.com/MapsService/V1/geocode?appid=YahooDemo&location=";
    $apiURL "http://local.yahooapis.com/MapsService/V1/geocode?appid=DoO9dXzV34FMVcI3aXjfoWLtUj_UBTBW4ltfKXiEDnXMnbm2DJ__79_Aw.n3EA--&location=";
     
     
    $addressData file_get_contents($apiURL.urlencode($address));


      
    $results $this->xml2array($addressData);

            if (empty(
    $results['ResultSet']['Result']['Address'])){
                
    $pointer count($this->invalidPoints);
                
    $this->invalidPoints[$pointer]['lat']= $results['ResultSet']['Result']['Latitude'];
                
    $this->invalidPoints[$pointer]['long']= $results['ResultSet']['Result']['Longitude'];
                
    $this->invalidPoints[$pointer]['passedAddress'] = $address;
                
    $this->invalidPoints[$pointer]['htmlMessage'] = $htmlMessage;
                
    $this->$validFlag=1;
              }else{
                
    $pointer count($this->validPoints);
                
    $this->validPoints[$pointer]['lat']= $results['ResultSet']['Result']['Latitude'];
                
    $this->validPoints[$pointer]['long']= $results['ResultSet']['Result']['Longitude'];
                
    $this->validPoints[$pointer]['passedAddress'] = $address;
                
    $this->validPoints[$pointer]['htmlMessage'] = $htmlMessage;
                
    $this->$validFlag=0;
            }
        
        return 
    $pointer;
        }


    I can't figure it out, thanks,
    Last edited by jrough; 11-11-2009 at 09:43 PM.

  2. #2
    Senior Member dagon's Avatar
    Join Date
    Nov 2001
    Posts
    6,178
    its just public, not public var

    php 4 just had var

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •