NYCPHP Meetup

NYPHP.org

[nycphp-talk] Why doesn't this work: chained ?: expressions

Analysis & Solutions danielc at analysisandsolutions.com
Sun Jan 19 23:38:12 EST 2003


On Fri, Jan 17, 2003 at 11:50:27AM -0500, David Sklar wrote:
>
> $map = array ('one' => '01', 'two' => '02',
>               'three' => '03', 'four' => '04');
> $output = preg_match('/'.join('|',array_keys($map)).'/',$input,$matches)) ?
>           $map[$matches[0]] : '00';

Along these same lines, preg_replace() can be called with arrays.  See the 
manual for more info.

http://www.php.net/manual/en/function.preg-replace.php

--Dan

-- 
               PHP classes that make web design easier
    SqlSolution.info  | LayoutSolution.info |  FormSolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409



More information about the talk mailing list