Title: syntax error, unexpected &#8216;&#8221;&#8216;, expecting &#8216;,&#8217; or &#8216;;&#8217;
Last modified: July 21, 2018

---

# syntax error, unexpected ‘”‘, expecting ‘,’ or ‘;’

 *  Resolved [kelcet](https://wordpress.org/support/users/kelcet/)
 * (@kelcet)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/)
 * Hi, plugin has been working fine for following code until update a few versions
   back. I reverted to old version and code would work. However I updated today 
   and receive error. Cannot find my old copy so should fix current error. Thanks
   for your help.
    Code has been pulling last image that is uploaded to folder from
   webcam on island. You can see error on [nyc.nu](http://nyc.nu)
 *     ```
       $pictures = glob("TLIP/*.jpg"); 
       $no_pictures = count($pictures)-1;  // was missing ;
       $limit = $no_pictures-0;            // was missing ;
       for( $i = $no_pictures; $i >= $limit; $i--){  // removed ; after $i--
       echo "<img src=\"".$pictures[$i]."\" />"; 
       }
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fsyntax-error-unexpected-expecting-or%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Thread Starter [kelcet](https://wordpress.org/support/users/kelcet/)
 * (@kelcet)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10515082)
 * Had some comments about no current image. yachties use it to keep track of conditions
   in bay so did restore to Version 2.5.4. code works there.
 *  [davdebcom](https://wordpress.org/support/users/davdebcom/)
 * (@davdebcom)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10566444)
 * Does this version work (it does for me)
 *     ```
       $pictures = glob("TLIP/*.jpg"); 
       $no_pictures = count($pictures)-1; 
       $limit = $no_pictures-0;       
       for( $i = $no_pictures; $i >= $limit; $i--){ 
       echo '<img src="$pictures[$i]" />'; 
       }
       ```
   
 *  Thread Starter [kelcet](https://wordpress.org/support/users/kelcet/)
 * (@kelcet)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10578666)
 * Hi, sorry for delay currently out of country and reliable computer will try when
   home.
 *  Thread Starter [kelcet](https://wordpress.org/support/users/kelcet/)
 * (@kelcet)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10604109)
 * Hi with 3.0.5 On page I see…
 * $pictures = glob(“TLIP/*.jpg”); $no_pictures = count($pictures)-1; $limit = $
   no_pictures-0; for( $i = $no_pictures; $i >= $limit; $i–){ echo ”; }
 *  [davdebcom](https://wordpress.org/support/users/davdebcom/)
 * (@davdebcom)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10604111)
 * Did you check the PHP checkbox?
 *  Thread Starter [kelcet](https://wordpress.org/support/users/kelcet/)
 * (@kelcet)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10604114)
 * opps. No. Now I get generic image for where image should be. So we are getting
   closer. see on nyc.nu home page. Thanks
 *  [davdebcom](https://wordpress.org/support/users/davdebcom/)
 * (@davdebcom)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10604116)
 * Where should I look? There are multiple images.
 *  Thread Starter [kelcet](https://wordpress.org/support/users/kelcet/)
 * (@kelcet)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10604126)
 * On left side of page I put a line above where image should display saying
 * “LAST IMAGE FROM WEBCAM FOLDER – below”
 * using code from above…
    $pictures = glob(“TLIP/*.jpg”); $no_pictures = count(
   $pictures)-1; $limit = $no_pictures-0; for( $i = $no_pictures; $i >= $limit; 
   $i–){ echo ‘‘; }
 *  Thread Starter [kelcet](https://wordpress.org/support/users/kelcet/)
 * (@kelcet)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10605233)
 * Have solved issue. Went with different code. For those looking the folder where
   webcam images upload to is nyc . nu / TLIP / imagefilenamebydate.jpg
 *     ```
       $dir = 'TLIP';
       $base_url = '/TLIP';
       $newest_mtime = 0;
       if ($handle = opendir($dir)) {
           while (false !== ($file = readdir($handle))) {
               if (($file != '.') && ($file != '..')) {
                   $mtime = filemtime("$dir/$file");
                   if ($mtime > $newest_mtime) {
                       $newest_mtime = $mtime;
                       $show_file = "$base_url/$file";
                   }
               }
           }
       }
       print '<img src="' .$show_file. '" alt="Mooring Image">';
       ```
   
 * Thanks Kevin
 *  [davdebcom](https://wordpress.org/support/users/davdebcom/)
 * (@davdebcom)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10606702)
 * Great!

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘syntax error, unexpected ‘”‘, expecting ‘,’ or ‘;’’ is closed to new 
replies.

 * ![](https://ps.w.org/post-snippets/assets/icon-128x128.gif?rev=2545587)
 * [Post Snippets - Custom WordPress Code Snippets Customizer](https://wordpress.org/plugins/post-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/post-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-snippets/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [davdebcom](https://wordpress.org/support/users/davdebcom/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/syntax-error-unexpected-expecting-or/#post-10606702)
 * Status: resolved