[thechat] perl vs. php - string replacement
Joe Crawford
jcrawford at avencom.com
Thu May 31 13:47:02 CDT 2001
Joxn wrote:
> Hi,
> I want to "x"-out every character but leave the first two as they are.
> Just wondering if this can be done in PHP as easy as in Perl.
> Perl:
> substr($var,2,) =~ s/./x/g;
>
> PHP:
> $var = substr_replace($var, str_repeat("x", (strlen($var)-2)), 2);
>
> I can live with the PHP version, but it doesn't really look nice, eh?
You might look at this - perl style regular expressions in php...
http://www.php.net/manual/en/function.preg-replace.php
<tip type="food i grew up with">
humble chorizo - a mexican sausage, highly greasy and spicy -- optimal
preparation includes 2 eggs and as much chorizo as you like to taste -
scrambled. absolutely wonderful breakfast food. the dodgier the taco
stand, the better. makes a wonderful burrito as well.
my wife (of cuban heritage) has advised me that not all chorizos are the
same - most spanish-descended countries have some kind of chorizo - but
they are all different.
several recipes online: http://www.google.com/search?q=chorizo+mexican -
can't vouch for any of them - I'm able to buy stuff in the stores.
note: the grease really can be too much, for best results make sure they
drain it well.
also: i have tried a "vegetarian chorizo" - which actually wasn't bad
but had a mediciney aftertaste. sorry vegetarians, this is one taste
which requires meat. :-\
best with flour tortillas, but corn can work too. :-)
</tip>
- joe <http://ARTLUNG.COM/>
More information about the thechat
mailing list