fork download
  1. <?php
  2. $test = array(
  3. 'Required route parameter not passed: :param',
  4. 'The :property property does not exist in the :class class',
  5. 'The requested view :file.:ext could not be found',
  6. 'PHP internal call',
  7. 'API method :uri: :code');
  8.  
  9. function str13_run($matches) {
  10. return ":".str_rot13($matches[1]);
  11. }
  12.  
  13. $test=preg_replace_callback('/:(\w+)/s','str13_run',$test);
  14.  
  15. print_r($test);
  16.  
  17. //тест - переворачиваем обратно.
  18.  
  19. $test=preg_replace_callback('/:(\w+)/s','str13_run',$test);
  20.  
  21. print_r($test);
  22.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Required route parameter not passed: :cnenz
    [1] => The :cebcregl property does not exist in the :pynff class
    [2] => The requested view :svyr.:rkg could not be found
    [3] => PHP internal call
    [4] => API method :hev: :pbqr
)
Array
(
    [0] => Required route parameter not passed: :param
    [1] => The :property property does not exist in the :class class
    [2] => The requested view :file.:ext could not be found
    [3] => PHP internal call
    [4] => API method :uri: :code
)