-1

I have test.php like below:

<?
    class Track{

        public function displaySong($title, $duration){

            $data = $title + $duration

            return $data;
        }

    }
?>

how to run it on CMD?... like if i do like this with cmd

song1 = Track("Britney - Toxic", "0:3:51")
song2->displaySong()

It returns

Song :  Britney - Toxic, Duration:  0:3:51

on cmd display

Grokify
  • 15,092
  • 6
  • 60
  • 81
Dicky Raambo
  • 531
  • 2
  • 14
  • 28

1 Answers1

0
  1. you should use "",this is a suggestion php.net give enter image description here (this is been blocked by stackoverflow)

    1. you have an error at this : "$data = $title + $duration" => "$data = $title + $duration;"

    2. if you want run a php file in CMD, you need use as : php test.php argv1 argv[2] ... , argv is the data you want to give the test.php

    3. and the last , your test.php should add some code:

        public function displaySong($title, $duration){
      
           $data = $title + $duration;
      
           echo $data;
        }
      

      } $song = new Track(); $song->displaySong($argv1, $argv[2]);

Devin.Jin
  • 32
  • 3