fork(1) download
  1. <?php
  2.  
  3. $string = 'Diego:25:RJ';
  4.  
  5. preg_match('/(?P<nome>\w+):(?P<idade>\d+):(?P<estado>\w+)/', $string , $matches );
  6.  
  7. echo $matches['nome'] . "\n";
  8. echo $matches['idade'] . "\n";
  9. echo $matches['estado'] . "\n";
  10.  
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
Diego
25
RJ