$matches=array();
preg_match_all($regex, $fragment, $matches, PREG_PATTERN_ORDER);

I get the following error for the input $regex = [\]world[\] and $fragment = hello world:

Severity: Warning
Message: preg_match_all() [function.preg-match-all]: Compilation failed: missing terminating ] for character class at offset 11
Filename: controllers/admin.php
Line Number: 499

can someone please help ?? :(

the first [ starts a character class in a regex. if you intended to use the character [ then prepend it with a backslash.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.