i’d just do a regex and get it over with. unless you are doing enough iterations that it becomes a huge performance issue, it’s just easier to code (and understand when you look back on it)
$text="ignore everything except this (text)";
preg_match('#\((.*?)\)#', $text, $match);
print $match[1];
Related Contents:
- Remove empty array elements
- What is the difference between single-quoted and double-quoted strings in PHP?
- How do I strip all spaces out of a string in PHP? [duplicate]
- How can I capture the result of var_dump to a string?
- Converting an integer to a string in PHP
- Getting the first character of a string with $str[0]
- Convert a comma-delimited string into array of integers?
- PHP, get file name without file extension
- Remove first 4 characters of a string with PHP
- Why a function checking if a string is empty always returns true? [closed]
- Multi-line strings in PHP
- How to check that a string is an int, but not a double, etc.?
- Remove portion of a string after a certain character
- How to remove all leading zeroes in a string
- Remove a string from the beginning of a string
- PHP string “contains” [duplicate]
- How to convert array values to lowercase in PHP?
- PHP – iterate on string characters
- Remove excess whitespace from within a string
- Best XML Parser for PHP [duplicate]
- Parsing a string into a boolean value in PHP
- Print newline in PHP in single quotes
- Check if URL has certain string with PHP
- What is for Python what ‘explode’ is for PHP?
- PHP YAML Parsers [closed]
- Convert string with dashes to camelCase
- Why does PHP convert a string with the letter E into a number?
- Calling PHP functions within HEREDOC strings
- How do I remove all specific characters at the end of a string in PHP?
- Get the first letter of each word in a string
- Limit String Length
- How can strip whitespaces in PHP’s variable?
- PHP: Split string [duplicate]
- PHP number: decimal point visible only if needed
- Split camelCase word into words with php preg_match (Regular Expression)
- Most efficient way to get next letter in the alphabet using PHP
- How can I get a hex dump of a string in PHP?
- PHP convert string to hex and hex to string
- Measure string size in Bytes in php
- PHP – remove tag from string
- How to replace multiple items from a text string in PHP? [duplicate]
- Convert a String into an Array of Characters
- How do search engines find relevant content?
- Grab remaining text after last “/” in a php string
- How to check if letter is upper or lower in PHP?
- How to convert the time from AM/PM to 24 hour format in PHP?
- How do I get the value from object(stdClass)?
- Question about strpos: how to get 2nd occurrence of a string?
- How create an array from the output of an array printed with print_r?
- Obtain first line of a string in PHP