Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 46 public static function format($messages, $number)
- 47 {
- 48 $n=preg_match_all('/\s*([^#]*)\s*#([^\|]*)\|/',$messages.'|',$matches);
- 49 if($n===0)
- 50 return $messages;
- 51 for($i=0;$i<$n;++$i)
- 52 {
- 53 $expression=$matches[1][$i];
- 54 $message=$matches[2][$i];
- 55 if($expression===(string)(int)$expression)
- 56 {
- 57 if($expression==$number)
- 58 return $message;
- 59 }
- 60 elseif(self::evaluate(str_replace('n','$n',$expression),$number))
- 61 return $message;
- 62 }
- 63 return $message; // return the last choice
- 64 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement