- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP fetch a specific value that begins with a given number from a string with letters and numbers?
Let’s say the following is our string with letters and numbers −
We ant a specific value beginning from 989 i.e.−
For this, use substr() along with strpos().
<!DOCTYPE html> <html> <body> <?php $value ="1045632245555fghjklm67535454663443gfdjkbvc9890000006777743"; echo "The actual value is=",$value,"<br>"; $result=substr($value, strpos($value,"989"), 16); echo "The filter value is=",$result; ?> </body> </html>
The actual value is=1045632245555fghjklm67535454663443gfdjkbvc9890000006777743 The filter value is=9890000006777743
- Fetch a specific record from a column with string values (string, numbers and special characters) in MySQL
- MySQL REGEXP to fetch string + number records beginning with specific numbers?
- Match MongoDB documents with field value greater than a specific number and fetch them?
- Find if a string begins with a specific set of characters in Arduino
- Two ways to fetch maximum value from a MySQL column with numbers
- Fetch maximum value from a column with values as string numbers like Value440, Value345, etc. in SQL
- PHP preg_split to split a string with specific values?
- How do I split the letters and numbers to two arrays from a string in PHP
- Select elements whose attribute value begins with a specified value with CSS
- MySQL RegExp to fetch records with only a specific number of words
- MongoDB query to retrieve records from a collection named with letters and numbers
- How to query MongoDB a value with $lte, $in and $not to fetch specific values?
- Fetch data between two dates and with a specific value in MongoDB. Group and get the sum with count?