Revision 3157de6c-9d6e-4881-bfff-a4ae493aa514 - Code Golf Stack Exchange

## Perl 34 (+1) chars ##

<!-- language-all: lang-perl -->

 $\++,$_*=$_&1?3+1/$_:.5while$_>1}{

Abusing `$\` for final output, as per usual. Run with the `-p` command line option, input is taken from `stdin`.

Saved one byte due to [Elias Van Ootegem](https://codegolf.stackexchange.com/posts/comments/162982?noredirect=1). Specifically, the observeration that the following two are equivalent:

 $_=$_*3+1
 $_*=3+1/$_

Although one byte longer, it saves two bytes by shortening `$_/2` to just `.5`.

Sample usage:

 $ echo 176 | perl -p collatz.pl
 18

<hr>

## PHP 54 bytes ##

<!-- language-all: lang-php -->

 <?for(;1<$n=&$argv[1];$c++)$n=$n&1?$n*3+1:$n/2;echo$c;

Javascript's archnemesis for the Wooden Spoon Award seems to have fallen a bit short in this challenge. There's not a whole lot of room for creativity with this problem, though. Input is taken as a command line argument.

Sample usage:

 $ php collatz.php 176
 18

AltStyle によって変換されたページ (->オリジナル) /