-3

I just want to build a php function that checking if string is contain brackets and return boolean, anyone can help?

example:

$string = "{hallo}"; // true
$string2 = "h{allo}"; //true
$string3 = "hal}{o"; //false
$string4 = "hallo{}";//false

1 Answers1

0

Check this

<?php

$string = "{hallo}"; 

$res = preg_match('/{\w+}/',$string);

print_r($res);

?>