Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. 46 public static function format($messages, $number)
  2. 47 {
  3. 48 $n=preg_match_all('/\s*([^#]*)\s*#([^\|]*)\|/',$messages.'|',$matches);
  4. 49 if($n===0)
  5. 50 return $messages;
  6. 51 for($i=0;$i<$n;++$i)
  7. 52 {
  8. 53 $expression=$matches[1][$i];
  9. 54 $message=$matches[2][$i];
  10. 55 if($expression===(string)(int)$expression)
  11. 56 {
  12. 57 if($expression==$number)
  13. 58 return $message;
  14. 59 }
  15. 60 elseif(self::evaluate(str_replace('n','$n',$expression),$number))
  16. 61 return $message;
  17. 62 }
  18. 63 return $message; // return the last choice
  19. 64 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement