I just want to build a php function that checking if string is contain brackets and return boolean, anyone can help?
example:
JavaScript
x
$string = "{hallo}"; // true
$string2 = "h{allo}"; //true
$string3 = "hal}{o"; //false
$string4 = "hallo{}";//false
Advertisement
Answer
Check this
JavaScript
<?php
$string = "{hallo}";
$res = preg_match('/{w+}/',$string);
print_r($res);
?>