try catch error


Posted on 16th Feb 2014 07:03 pm by admin

I have been trying try catch but, I can't get it to work. The code opens a non existing file called "a"

Code: private function fileOpenMethod($filePath, $numberOfLines,$header,$replaceHeader){
try{
$file = file( $filePath);
}catch(file $e){
$e= "the flie path does not work"; //. $e->getMessage();
}

return $e;
}
I am getting an error message on the page but not the one that am trying to generate
Code: Warning: file(a) [function.file]: failed to open stream: No such file or directory in /home/public_html/_Doc/StripFileClass.php on line 15

I am sure it is simple but I am new to try and catch and it is a learning curve blah blah blah.
Can anyone see what I am doing wrong =)

No comments posted yet

Your Answer:

Login to answer
320 Like 17 Dislike
Previous forums Next forums
Other forums

Simple Question
I know this is a simple question, that if I knew what it was technically called i could probably loo

phpmailer class & pop.gmail.com?
Code: <?php
$mail->IsSMTP();
$mail->Host = "pop.gmail.com";

Select all entries from database that include a phrase
I have a database of clubs - one of the categories is meeting time and place
I would like to have

How can I Compare two xml documents?
Hi all,

I am doing a POC for my project and I am using XE database 10g version.

Doubles are giving me problems
Ok so, first of all i made a double = 0.05, but when running the debugger it shows up as 0.04999. I

close site for maintenance
i get a tutorial, saying the following code can put our site offline, and only the developer can vie

default SAP userid
hi,, I just like to know if it is ok to use the default SAP user id (SAP*)?

creating a 1 to 100 in a table
hi guys I am a newb in php need some help.

I have a table with 1 column and 100 rows and in

foreach loop, assistance request
I would like some guidance on the usage of foreach as I try to parse through a large database and wh

Logic question
im wondering what's the best method to do the above list:

it is for alliance @ MMORPG game

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash