Superman859 wrote:One thing to note...if you are not dealing with keys, you don't need to write $key.
Yep, well spotted!
Was just testing
Superman859 wrote:However, from what I understand, if you continue with another string (for example if you made a loop and were going to get the initials of many users), you would want to reset $abbr each time. Otherwise it would continue adding on to the first initials/etc. I could be wrong, I'm just beginning, but I do come from having a strong Java background.
Again, yep. I will do that, as I'll set this up as a function.
Superman859 wrote:$abbr .= $word{0}; //I believe this is similar to charAt() in other languages...returns the character at given position.
Out of all these different suggestions, explode() seems the simplest one.
I try to steer clear of regular expressions unless they're absolutely needed as I always thought there's a processing overhead, but also because I don't understand regex syntax
Anyone have any info on this type of syntax?
Where would I find it in the PHP manual?
I'm assuming that since this syntax seems to be a language construct, it should give better performance than using a function like substr()?
Not that it really matters for such a small function. Just like to know I'm doing things the best way!!
Thanks for all your help everyone!!!
Ben