‫Okay, so this will be a short video.
‫I just want to add a couple helper functions that I usually add to my projects like this.
‫And we're going to have an inspect which is basically a var dump with pre tags around it.
‫So we can use that to inspect certain variables, certain certain arguments that come in certain arrays,
‫things like that.
‫And we'll also have a function called inspect and die which will cut the script after it prints out
‫whatever you're looking for.
‫And the reason I have both is because you might want to just have, you know, the script, stop after
‫you inspect something, or you might want to use inspect and use it multiple times because you can't
‫use inspect and die multiple times because after the first one it will cut the script.
‫So let's do that.
‫Let's come down at the bottom here.
‫And let's say this will inspect a value or values.
‫And as far as a pram, I'll say mixed because it could be anything.
‫It could be an array or a string.
‫Just any whatever, whatever variable, whatever the variable holds.
‫And we'll call that value.
‫And then as far as a return it's going to be void because it's just going to print it out to the screen.
‫So let's say function inspect takes in a value.
‫And then we're going to echo out.
‫A pre tag to format it.
‫We're going to have a closing pre tag.
‫And in the middle we'll do a VAR dump.
‫So it's just saving us a couple of lines.
‫All right.
‫And that we can use multiple times.
‫Now I'm going to copy this and we're going to create another one.
‫And this one we're going to say inspect a value and die.
‫So die is a is a function that we can call to just kill the script.
‫So nothing else happens.
‫The param same thing value.
‫And we're going to change the name of the function to inspect and die.
‫I know it sounds kind of violent, but we take the value in echo pre.
‫And then we could either do this so we could call die at the bottom or we could even.
‫Go like this.
‫We can say die and we can wrap the vardump like that, and that will do the same thing.
‫So now we'll have these two helper functions to help us out if we want to see what something is.
‫So as an example, let's say when we load a view right when this load view comes, maybe we want to
‫see maybe we want to see what what this view path actually is, including the base and all that.
‫So we could say inspect.
‫Pass in view path.
‫And then let's reload the page and.
‫Up at the top, you'll see we have a string and the view path here is users Brad Travis projects.
‫So basically my working directory slash views slash home dot view dot PHP.
‫All right.
‫Now I can use this more than once.
‫Like I could do it again.
‫And I could say, well what's in the name that's being passed in.
‫Let's actually move that up there.
‫So if I do that, you'll see the name that's being passed in is home in this case.
‫So it's looking at if we look at index PHP it's looking at this right now if I use inspect and die.
‫What that's going to do is.
‫And what that's going to do is kill the script after.
‫So if I reload, you'll see.
‫It'll show me that name which is home, but then nothing else.
‫And you might want to do this because it's less confusing, because you have nothing else on the screen.
‫All right.
‫So really simple stuff.
‫I just think that these these can be helpful throughout the rest of the, of the project.
‫So that's all I wanted to do in this video.
‫And the next one we're going to start on our router.
‫And we're going to refactor this router probably about 4 or 5 times.
‫So we'll start off with something very, very simple.
‫And then we'll end up with something where we can actually pass in class methods and middleware and
‫stuff like that.