I am trying to run some php from the command line but the php in my class is not being hit.
<?php
print "1";
try {
print ",2";
$a = new myClass("");
}
catch (Exception $e) {
print $e->getMessage();
}
print ",3";
myClass
<?php
class myClass{
function __construct($var) {
print "My Class";
}
}
The output I am getting is:
1,2
Process finished with exit code 255
Why is the print in the constructor not outputting to the command line?
you should be doing
$a = new Checkout();as that is the name of your class, even though you have it in a file named myclass.php probably. you should have gotten the following error:You are not getting the 3 either because the code is failing and exiting, weird you are not seeing an error. PS, it throws a fatal error, not an exception, prolly why it did not CATCH it.
Here is the code i am running via command line: