Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Created May 21, 2012 16:32
Show Gist options
  • Save wilmoore/2763153 to your computer and use it in GitHub Desktop.
Save wilmoore/2763153 to your computer and use it in GitHub Desktop.
Hashbang'd PHP script via php-version: https://github.com/wilmoore/php-version

Get php-version @ github.com/wilmoore/php-version then:

Initial Run (my default version of PHP is 5.4.0)

./script.php

Result

Active PHP version: 5.4.0

Switch to version 5.3.10

php-version 5.3.10 >/dev/null && ./script.php

Result

Active PHP version: 5.3.10
#!/usr/bin/env php
<?php
// chmod +x script.php
echo 'Active PHP version: ', phpversion(), PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment