Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

question

Recommended Posts

what does the needle, and haystack mean in this function prototype.
string strstr ( string haystack, string needle)

string stristr ( string haystack, string needle)

Share this post


Link to post
Share on other sites
if you search the manual for the function stristr

"Returns all of haystack from the first occurrence of needle to the end. needle and haystack are examined in a case-insensitive manner."

[code]
<?php
  $string= 'this is a string';
  echo stristr($string, 'a');
// outputs "a string"
?>
[/code]

basically, it searches the string for the first time that the 2nd value "needle" appears and then shows everything from that point on

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.