use this code
$input = "[modid=256]";
preg_match('~=(.*?)]~', $input, $output);
echo $output[1]; // 256
working example http://codepad.viper-7.com/0eD2ns
More Related Contents:
- Using PHP substr() and strip_tags() while retaining formatting and without breaking HTML
- How to get first x chars from a string, without cutting off the last word?
- php substr() function with utf-8 leaves � marks at the end
- How do I remove the last comma from a string using PHP?
- Delete first 3 characters and last 3 characters from String PHP
- How can I connect to a Tor hidden service using cURL in PHP?
- Laravel validation attributes “nice names”
- PHP syntax highlighting [closed]
- Can I do a CURL request to the same server?
- Call parent constructor before child constructor in PHP
- Array size limit in PHP
- how to embed html files in php code?
- How do I save PHP session data to a database instead of in the file system?
- Programmatically building htpasswd
- Youtube I.D parsing for new URL formats
- MySQL, how to insert null dates
- Escaping SQL queries in Codeigniter
- Subtracting a certain number of hours, days, months or years from date
- enabling cors in codeigniter ( restserver by @chriskacerguis )
- mongodb get _id as string in find query
- displaying a message after redirecting the user to another web page [duplicate]
- PHP – GetSQLValueString function
- How are associative arrays implemented in PHP?
- How to call a php function from ajax?
- Sending XML data using HTTP POST with PHP
- PHP Event-Listener best-practice implementation
- PHP: HTTP or HTTPS? [duplicate]
- Regex to match an IP address [closed]
- Difference between PDO->query() and PDO->exec()
- PHP’s preg_replace regex that matches multiple lines