This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
city=(London Paris Milan "New York") | |
echo ${city[3]} | |
# New York | |
echo ${#city[@]} | |
# 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
json_decode(file_get_contents($file), true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$line_number = 1; | |
while (($line = fgets(STDIN)) !== false) { | |
$result = check_line_length(trim($line), $line_number++, $opts); | |
echo cli_report("(standard input)", array($result), $opts); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = stream_get_contents(STDIN); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Handle any input piped or redirected here | |
if (!posix_isatty(STDIN)) { | |
process(stream_get_contents(STDIN)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
exit(ERR_BAD_CONFIG); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
fwrite(STDERR, "bad error: no config file. install one.\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
while (count($args) && $args[0][0] == "-") { | |
//... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
for ($ch = 1; $ch < strlen($arg); $ch++) { | |
switch ($arg[$ch]) { | |
case 'c': $opts['show_content'] = false; break; | |
case 'm': $opts['max_length'] = handle_arg(substr($arg, $ch), $args); break; | |
//... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($arg == "--help") { | |
fwrite(STDOUT, usage(true)); | |
exit(0); | |
} |
NewerOlder