2

I am having a php script that i would like to run on CLI (Command line Interface). I have used some echo statements in class a's constructor and from there I am calling its parrent constructor where i am using one more echo statement. i am not able to see the parent class's echo statement however If i run the same script with browser i can see all the echos. here is a part of my code.

class CImportEmployeeScript extends CScripts {
function __construct() {
    echo "Child File Constructor";
    parent::__construct();
}
    ----
    ----
}

class CScripts {
function __construct() {
    echo "In Parrent File";
    }
    ----
    ----
}

If my php files (Child And Parrent) do not use same path is their any possibility of the above problem..

2
  • So to sum up, you are instantiating a CImportEmployeeScript and you only see Child File Constructor output instead of Child File ConstructorIn Parrent File as you would expect from the above script? Do you get any error messages? Please can you ini_set('display_errors', 1); error_reporting(E_ALL); at the top of your script? Commented Aug 7, 2012 at 9:31
  • @DaveRandom I did that earlier.. but that doesn't help. It doesn't show any error. Commented Aug 7, 2012 at 10:56

1 Answer 1

1

class class CScripts doesn't extend anything so remove parent::__construct();

Sign up to request clarification or add additional context in comments.

3 Comments

A good point but I doubt this is the problem as you would still see the result of echo "In Parrent File"; before you hit the inevitable fatal error.
@ARIF MAHMUD RANA thanks but that was just a writing mistake. i have corrected that.. Jazakallah-u-kher
@DaveRandom If the error reporting is stopped than how you will see the fatal error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.