Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mb_stristr(3) [php man page]

MB_STRISTR(3)								 1							     MB_STRISTR(3)

mb_stristr - Finds first occurrence of a string within another, case insensitive

string mb_stristr (string $haystack, string $needle, [bool $before_needle = false], [string $encoding = mb_internal_encoding()]) DESCRIPTION
mb_stristr(3) finds the first occurrence of $needle in $haystack and returns the portion of $haystack. Unlike mb_strstr(3), mb_stristr(3) is case-insensitive. If $needle is not found, it returns FALSE. PARAMETERS
o $haystack - The string from which to get the first occurrence of $needle o $needle - The string to find in $haystack o $before_needle - Determines which portion of $haystack this function returns. If set to TRUE, it returns all of $haystack from the beginning to the first occurrence of $needle (excluding needle). If set to FALSE, it returns all of $haystack from the first occurrence of $needle to the end (including needle). o $encoding - Character encoding name to use. If it is omitted, internal character encoding is used. RETURN VALUES
Returns the portion of $haystack, or FALSE if $needle is not found. SEE ALSO
stristr(3), strstr(3), mb_strstr(3). PHP Documentation Group MB_STRISTR(3)

Check Out this Related Man Page

STRSTR(3)								 1								 STRSTR(3)

strstr - Find the first occurrence of a string

string strstr (string $haystack, mixed $needle, [bool $before_needle = false]) DESCRIPTION
Returns part of $haystack string starting from and including the first occurrence of $needle to the end of $haystack. Note This function is case-sensitive. For case-insensitive searches, use stristr(3). Note If you only want to determine if a particular $needle occurs within $haystack, use the faster and less memory intensive function strpos(3) instead. PARAMETERS
o $haystack - The input string. o $needle - If $needle is not a string, it is converted to an integer and applied as the ordinal value of a character. o $before_needle - If TRUE, strstr(3) returns the part of the $haystack before the first occurrence of the $needle (excluding the needle). RETURN VALUES
Returns the portion of string, or FALSE if $needle is not found. CHANGELOG
+--------+-----------------------------------------------+ |Version | | | | | | | Description | | | | +--------+-----------------------------------------------+ | 5.3.0 | | | | | | | Added the optional parameter $before_needle. | | | | | 4.3.0 | | | | | | | strstr(3) was made binary safe. | | | | +--------+-----------------------------------------------+ EXAMPLES
Example #1 strstr(3) example <?php $email = ''; $domain = strstr($email, '@'); echo $domain; // prints $user = strstr($email, '@', true); // As of PHP 5.3.0 echo $user; // prints name ?> SEE ALSO
stristr(3), strrchr(3), strpos(3), strpbrk(3), preg_match(3). PHP Documentation Group STRSTR(3)

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Stripping a portion of string from behind!!!

Hi, How to strip a portion of a file name from behind...Say for Eg..i have a file name like aaaaa.bbbbb.Mar-17-2007 i want to remove there a one line command which can give this output... Thanks Kumar (5 Replies)
Discussion started by: kumarsaravana_s
5 Replies

2. Shell Programming and Scripting

Third line occurrence replacement

You guys are really smart, so I'm hoping someone can help me out with this. I would like to match the third line occurrence of a pattern at the beginning of a line in a file and replace it. I'm ok at using sed but I have no clue about this one. Thanks in advance. (5 Replies)
Discussion started by: sirokket16
5 Replies

3. Shell Programming and Scripting

count a occurrence

I am looking to get a output of "2 apple found" from the awk command below. black:34104 tomonorisoejima$ cat tomo apple apple black:34104 tomonorisoejima$ awk '/apple/ {count++}END{print count " apple found"}' tomo 1 apple found black:34104 tomonorisoejima$ (5 Replies)
Discussion started by: soemac
5 Replies

4. Shell Programming and Scripting

Displaying only First Occurrence of a String

Hi, My requirement is that I should search for a particular string and display the string only once if there is more occurrence of the same string in a file. e.g In the given below log file,the string AMQ5037 comes twice.I want to search for this string and display it only once.grep will... (5 Replies)
Discussion started by: charudpss
5 Replies

5. Shell Programming and Scripting

Uniq adresses with number of occurrence

Alo I have a file with a lot of addresses where I want to list unique addresses and the number of theirs occurrence. I have this input file: 0011bd09 ea 01 0b 04 ea 01 0b 38-bd 11 00 98 15 cb 01 00 .......8........ 0011bd09 ea 11 00 98 15 cb 01 00-00 00 00 d8 3d 8d 01 94 ... (5 Replies)
Discussion started by: chitech
5 Replies

6. Shell Programming and Scripting

reading and calculating no. of occurrence in awk

:confused:Hi, I have got results from my simulation and I did extract the time field from the results file into new file. Then I was trying to calculate no. of occurrence for each set of time. However, I couldn't. For example : 0.2 -- 0.2 -- 0.21016 -- 0.21016 -- 0.21016 -- . . .... (12 Replies)
Discussion started by: ENG_MOHD
12 Replies

7. Shell Programming and Scripting

remove characters from string based on occurrence of a string

Hello Folks.. I need your help .. here the example of my problem..i know its easy..i don't all the commands in unix to do this especiallly my string.. dwc2_dfg_ajja_dfhhj_vw_dec2_dfgh_dwq desired output is.. dwc2_dfg_ajja_dfhhj it's a simple task with tail... (5 Replies)
Discussion started by: victor369
5 Replies

8. Shell Programming and Scripting

Count no of occurrence of the strings based on column value

Can anyone help me to count number of occurrence of the strings based on column value. Say i have 300 files with 1000 record length from which i need to count the number of occurrence string which is existing from 213 to 219. Some may be unique and some may be repeated. (8 Replies)
Discussion started by: zooby
8 Replies

9. Shell Programming and Scripting

find string nth occurrence in file and print line number

Hi I have requirement to find nth occurrence in a file and capture data from with in lines (between lines) Data in File. <QUOTE> <SESSION> <ATTRIBUTE NAME='Parameter Filename' VALUE='file1.parm'/> <ATTRIBUTE NAME='Service Name' VALUE='None'/> </SESSION> <SESSION> <ATTRIBUTE... (6 Replies)
Discussion started by: tmalik79
6 Replies

10. UNIX for Dummies Questions & Answers

awk for trimming a string up to the first, then second, then third... match

Hi ! With awk, I would need to trim a string from the beginning up to the first occurrence of "1", then from the beginning up to the second occurrence of "1", then from the beginning up to the third, then the fourth...., then the last occurrence of "1". input: 1aaa1bb1ccccccc dd1e1ffff... (7 Replies)
Discussion started by: beca123456
7 Replies

11. UNIX for Dummies Questions & Answers

Sed, last occurrence

How to find last occurrence of a keyword in a file using sed. (4 Replies)
Discussion started by: nexional
4 Replies

12. UNIX for Dummies Questions & Answers

[Solved] Replace first occurrence after match

hey guys, i have been trying to work this thing out with sed with no luck :confused: i m looking for a way to replace only the first occurrence after a match for example : Cat Realized what you gotta do Dog Realized what you gotta do Sheep Realized what you gotta do Wolf Realized... (6 Replies)
Discussion started by: boaz733
6 Replies

13. Shell Programming and Scripting

Replacing old TNS entries with New one in multiple files

I have requirement to replace old TNS entries with New one in multiple files. one file may contain more then one occurrence of tns. Example: Below is the one of occurrence in a current file(s). i am interested to replace only red part. <connection-pool name="Google_APP_CP"... (4 Replies)
Discussion started by: KDDubai333
4 Replies

14. Shell Programming and Scripting

Substitute first occurrence of keyword if occurrence between two other keywords

Assume a string that contains one or multiple occurrences of three different keywords (abbreviated as "kw"). I would like to replace kw2 with some other string, say "qux". Specifically, I would like to replace that occurrence of kw2 that is the first one that is preceded by kw1 somewhere in the... (4 Replies)
Discussion started by: M Gruenstaeudl
4 Replies

15. UNIX for Beginners Questions & Answers

Append a particular string after occurrence of particular string.

Hi Friends, Good morning. Appended a particular string after occurrence of particular string in a file. my file abc.sql as below create or replace function f1(p_cust_no IN VARCHAR) RETURN number IS DECLARE v_country country.customer_tbl%TYPE; begin begin select... (4 Replies)
Discussion started by: ram0106
4 Replies

Featured Tech Videos