PHP Classes

on peut simplifier juste ceci : return $this->{"read_$file_ex...

Recommend this page to a friend!

      PHP DOC DOCX PDF to Text Converter  >  All threads  >  on peut simplifier juste ceci :...  >  (Un) Subscribe thread alerts  
Subject:on peut simplifier juste ceci :...
Summary:Package rating comment
Messages:4
Author:Yves Marie HAMAYON
Date:2014-11-18 16:08:38
 

Yves Marie HAMAYON rated this package as follows:

Utility: Good
Consistency: Good
Examples: Good

  1. on peut simplifier juste ceci :...   Reply   Report abuse  
Picture of Yves Marie HAMAYON Yves Marie HAMAYON - 2014-11-18 16:08:38
on peut simplifier juste ceci :
return $this->{"read_$file_ext"}();

bravo

  2. Re: on peut simplifier juste ceci :...   Reply   Report abuse  
Picture of Aditya Sarkar Aditya Sarkar - 2014-11-19 06:06:13 - In reply to message 1 from Yves Marie HAMAYON
Can you please write it again in english?

  3. Re: on peut simplifier juste ceci :...   Reply   Report abuse  
Picture of Aditya Sarkar Aditya Sarkar - 2014-11-19 06:06:14 - In reply to message 1 from Yves Marie HAMAYON
Can you please write it again in english?

  4. Re: on peut simplifier juste ceci :...   Reply   Report abuse  
Picture of Yves Marie HAMAYON Yves Marie HAMAYON - 2014-11-19 18:02:34 - In reply to message 3 from Aditya Sarkar
if($file_ext == "doc" || $file_ext == "docx"){
if($file_ext == "doc") {
return $this->read_doc();
} else {
return $this->read_docx();
}
} else if( $file_ext == "pdf" ){
$this->setFilename( $this->filename );
$this->decodePDF();
return $this->output();
} else {
return "Invalid File Type";
}
//--
// we can write : (just a little modif, not important)
//--
if($file_ext == "doc" || $file_ext == "docx"){
return $this->{"read_$file_ext"}();
}else if($file_ext == "pdf"){
$this->setFilename( $this->filename );
$this->decodePDF();
return $this->output();
}else{
return "Invalid File Type";
}