fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. $s = "adceb";
  6. $p = "*a*b";
  7.  
  8. $p = str_replace(array("?"),array("."),$p);
  9. $p = preg_replace("/\*+/", ".*+",$p);
  10. $p="/^$p"."$/";
  11.  
  12. print_r($s);
  13. print_r($p);
  14.  
  15. if (preg_match($p, $s, $match)) {
  16. // print_r($match);
  17.  
  18. if($match[0] == $s){
  19. print_r("true");
  20. }else{
  21. print_r("false");
  22. }
  23. }else {
  24. print_r('false');
  25. }
Success #stdin #stdout 0.02s 25464KB
stdin
Standard input is empty
stdout
adceb/^.*+a.*+b$/false