Welcome Guest, Not a member yet? Register   Sign In
preg_replace
#1

[eluser]laegnur[/eluser]
Hi

I'm using the Jamie Rumbelow's "My_Model" class, and wanted to know exactly what this does:

Code:
$class = preg_replace('/(_m|_model)?$/', '', get_class($this));
#2

[eluser]danmontgomery[/eluser]
strips _m or _model from the end of the class name if they are there
#3

[eluser]laegnur[/eluser]
Hi

And if I do the same, but in the beginning?

Code:
$class = preg_replace('/(m_|model_)?$/', '', get_class($this));

This would be correct?
#4

[eluser]crnalajna[/eluser]
'/^(m_|model_)/'




Theme © iAndrew 2016 - Forum software by © MyBB