There is such a question. How to run a class from cli. The whole architecture works except for launching from the command line. I found this solution, but I can't figure it out

class Commander { function __construct(array $option) { switch (key($option)){ case "one": echo "one"; break; case "two": echo "two"; break; case "help"||"h": default: echo 'Help'; }} } $option=getopt("o:t:h",["one:","two:","help:"]); new Commander($option); 
  • some confusion, sorry. Which class? How do you use it? What exactly can not figure out? - rjhdby
  • In cases instead of echo, there is a new Class (); you need to run the corresponding cases from the terminal (1.2, etc.). Now it always gives the default value - help - yuralucky
  • Give exactly the code with which you have problems. And describe what exactly the problem. Which mistakes? What is not working as you expected? - rjhdby
  • / PhpstormProjects / Project1 / src $ php Commander.php Helpyura @ yura-Aspire-V5-572G ~ / PhpstormProjects / Project1 / src $ - yuralucky
  • $ php Commander.php // I run without parameters, it gives the "help" default. Help - yuralucky

0