vim example.phpCopy and paste the following text into your new example.php file:
<?php $name = trim(shell_exec("read -p 'Enter your name: ' name\necho \$name")); echo "Hello $name this is PHP speaking\n"; exit;Save the example.php file.
Next, experience your new PHP program (example.php) capture your user input from the cmd line by copying and pasting the following command into your shell:
php example.phpIt will prompt you with the following:
Enter your name:You will type your name and then hit enter as shown here:
Enter your name: JohnAfter you hit enter you'll see the PHP program we wrote print out the following text:
Hello John this is PHP speakingLooking for a cloud-based catalog and CRM platform? Checkout http://rocware.com/