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

Help with PHP Email Script
Hi guys,

I'm a newbie to php and need help with the script below:

At the moment when I

Retreiving objects from Sessions
Hi all,

I am getting really frustrated with storing and retreiving objects from a session. Bu

Something like an INI editor or a DelimitedText-Editor
Hi all,

Am very, very, very new to PHP and not sure if I should be posting this to a Javascri

Disabling SAP menu
How do I disable SAP menu for all the users and just restrict them to User Menu in SAP ECC 6.0?

How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou

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

it is for alliance @ MMORPG game

Saas with SAP R/3
hi experts,

Is SaaS offer available in SAP? for SAP R/3? from where i can get the info a

iterating through an array and escape each value independently.
I have a set up where the variable being escaped is an array and it needs to be iterated and escaped

A little help in c#
i am doing a simple paint program using c# i want to draw with the mouse so i wrote the code of the

Good Programming and Web Design Books
Hi,

I recived a pm today from a fellow phpfreaker regarding php books, i replied with the fo

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