Re: Unexcepted $this
| From: | Murat BEŞER | Date: | Sun, 09 Mar 2008 21:21:46 +0000 |
| Subject: | Re: Unexcepted $this | ||
| References: | 1 2 | Groups: | php.general php.general |
| Request: | Send a blank email to php-general+get-271183@lists.php.net to get a copy of this message | ||
Thank you Anup,
But why I getting this error ?
is this a bug ?
I have changed my code like this
if (in_array($this->getFileExtension($file), array('gif', 'jpg', 'png'))) {
}
but I can't understand.
Anup Shukla yazmış:
Murat BEŞER wrote:I can't under stood but PHP gaves me an error: "UnExcepted $this" for " || $this->getFileExtension($file) == 'jpg' " When I removed jpg extension check it's okay... PHP script runs well. What is the problem :) public function loadImages($folder) {if ( ($this->getFileExtension($file) == 'gif') || ($this->getFileExtension($file) == 'png') || ($this->getFileExtension($file) == 'jpg') ) { ... rest of your code ... }$result = $this->filemanager->fecthFiles($folder); $images = array(); if (sizeof($result)>=1 && $result !== false) { foreach ($result as $file) { if ($this->getFileExtension($file) == 'gif' || $this->getFileExtension($file) == 'png' || $this->getFileExtension($file) == 'jpg') {$images[] = array('name'=>$file); } } } return $images; }