This script has been created using PHP and it is showing the object-oriented concepts and using a CLI tool. The script accepts a string and does the following to it:
- converts the string to uppercase and outputs it to stdout.
- converts the string to alternate upper and lower case and outputs it to stdout.
- creates a CSV file from the string by making each character a column in the CSV and then output "CSV created!" to stdout. example: Sample Input hello world
Sample Output HELLO WORLD hElLo wOrLd CSV created!
Note: a CSV file is created on the root directory which containing the following: h,e,l,l,o, ,w,o,r,l,d
Software requirements :-
- PHP 7.0 or heigher
- LAMP or WAMP or XAMP server
How to run on Windows (For WAMP or XAMP server):-
- Download script file "oop_cli.php"
- Go to the PHP installation directory, for example C:/xampp/htdocs
- Create a project folder, for example "php_cli"
- Paste "php_oop_cli.php" file in created folder.
- Make sure running of the server
- Open "xamp command prompt"
- Go to the project folder, for example "cd C:/xampp/htdocs/php_cli"
- Run following command "php oop_cli.php"
How to run on Linux (For LAMP server):-
- Download script file "oop_cli.php"
- Go to the PHP installation directory, for example /var/www/html
- Create a project folder, for example "php_cli"
- Paste "cli.php" file in created folder.
- Make sure running of the server
- Open command prompt
- Go to the project folder, for example "cd /var/www/html/php_cli"
- Run following command "php oop_cli.php"
Note :- Project root directory should have writable permission in order to generate and store CSV file.