Skip to content

Instantly share code, notes, and snippets.

@ialexpw
Last active September 27, 2021 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ialexpw/8b26023071a0e4b8aad35a448ee483ee to your computer and use it in GitHub Desktop.
Save ialexpw/8b26023071a0e4b8aad35a448ee483ee to your computer and use it in GitHub Desktop.
Example
<?php
// For PHP 8+
foreach ($argv as $arg) {
if (str_contains($arg, '=')) {
list($arg_x, $arg_y) = explode('=', $arg);
$_GET[$arg_x] = $arg_y;
}
}
// For PHP < 8
foreach ($argv as $arg) {
if (strpos($arg, '=') !== false) {
list($arg_x, $arg_y) = explode('=', $arg);
$_GET[$arg_x] = $arg_y;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment