Skip to content

Instantly share code, notes, and snippets.

@terremoth
Created June 18, 2024 22:41
Show Gist options
  • Save terremoth/9230301a9ade7bb8d2641efda3a2aff0 to your computer and use it in GitHub Desktop.
Save terremoth/9230301a9ade7bb8d2641efda3a2aff0 to your computer and use it in GitHub Desktop.
Gets the input string from terminal stream and converts all the words to uppercase first chars
<?php
/**
* @author terremoth
* @license GNU General Public License, version 3
*/
$stream = file_get_contents("php://stdin");
$rows = explode("\n", $stream);
foreach ($rows as $row) {
echo ucwords(strtolower($row)).PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment