Ubunt00 Posted April 26, 2012 Share Posted April 26, 2012 Hello everyone, I am trying to create a function called strleading that basically reads two strings, and returns true if a certain amount of leading strings are equivalent. It will be something like this: function strleading (cheesecake, cheese, 6) echo stlreading; returns true || false; basically the parameters that I have made in my pseudo code are the two strings cheesecake and cheese, the number six, is the amount of characters that have to match in the two strings in order for them to be considered a true match. I want this to work for all words that have similar leading letters. Please help. Thank You. Quote Link to comment https://forums.phpfreaks.com/topic/261613-creating-strleading-function/ Share on other sites More sharing options...
trq Posted April 26, 2012 Share Posted April 26, 2012 Take a look at substr. Quote Link to comment https://forums.phpfreaks.com/topic/261613-creating-strleading-function/#findComment-1340580 Share on other sites More sharing options...
requinix Posted April 26, 2012 Share Posted April 26, 2012 I am trying to create a function called strleading that basically reads two strings, and returns true if a certain amount of leading strings are equivalent. You mean like strncmp? Quote Link to comment https://forums.phpfreaks.com/topic/261613-creating-strleading-function/#findComment-1340600 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.