http://qs1969.pair.com?node_id=1066474


in reply to Re: port a function from php
in thread port a function from php

Well... Consider this perl code for example:
sub ncp { ($_[0] ^ $_[1]) =~ m/\0*/; $+[0]; }
This returns the common prefix length for two given strings. Except when it fails, that is. Which happens when NUL's are present in the (longer) string. A case that has actually bitten me before. The PHP semantics would be a win sometimes.