 Okay, so we are continuing our tutorials on PHP and this time we're going to be exploding strings and really that's not nearly as fun as it sounds, but definitely still pretty cool and it's going to be pretty much very similar if not almost identical to our last tutorial. This is a series, this PHP series. This is video number seven. Hopefully there's an annotation somewhere on the screen right now if I didn't forget. That will lead you to the playlist. I recommend watching the previous videos in this playlist before continuing on with this one. Also, you should know at least some basic HTML before moving on to PHP. Now, as I said last tutorial, we were learning about splitting strings and today we're going to be working with exploding strings. And since it's so similar instead of writing out the code all over again, I am just going to copy my split code to a new file explode PHP. And then I'm going to go into it. Once again, I'm using VIM as my text editor, but feel free to use whatever text editor you prefer. It's personal personal preference. And here's our code. We've got a variable that contains a string that has a person's first name, last name and their occupation or job title there. And then what we're doing is we're splitting that by the commas and setting variables based on those elements and then outputting them into HTML format. And as I said, today instead of, well, let's first off save this, refresh this and we will open that up in the web browser and you can see how it outputs everything. Now, if I come down here and instead of split, I type explode and save it and rerun it. Yep, I refreshed it. Nothing changes. That's because pretty much we're doing the same exact thing here. But if I come back down here and I undo that and I put split back in there, you may remember the last tutorial I kind of got messed up and sorry, jump ahead in tutorials, I put in a pipe instead of a comma and then I went up here to my strings and put in my string and put in pipes instead of commas, saved it and I did get an error when I refreshed and it's saying errors on line three, which is this line here. And that would be because I'm passing split this pipe symbol. Well, let me come in here and change this from pipe from a split to explode, save it and run it again. Well, here you see we're back to it working again. That's because one of the main differences between split and explode is that split recognizes regular expressions. And when I was putting that pipe in there, split thought that I was trying to pass it some regular expressions and it confused it. So if you're not going to be using regular expressions, explode is a good option. Also from what I've read, explode works a little bit faster. Supposedly really in this particular case, we're talking fractions, small, small fractions of a second, but I tend to use explode more than I would split and one of the main reasons is I tend to use the pipe symbol a lot if I'm working with files, which we're going to get into the next story. I'll basically doing the same thing, but instead of with just a string within the text, a string within the script, we're going to be working with in files. And I like to use the pipe symbol when I'm making my files, CSV files, which really means comma separated values. No, I always forget these stands where I always say values, but I think it stands for something else. Anyway, I tend to use the pipe symbol because that's a lot less likely to cause problems because let's say you're putting an address and addresses have commas, so then you got to put quotations around each section as well split by commas. It just gets complicated. So I tend to use the pipe symbol just because it's, I mean, really, other than when you're coding, when do you type the pipe symbol? So a lot less lead to bump into errors there, little problems. So explode is a good option unless you need to use regular expressions. And then also there's another thing I've never used, but I have read about, which is P reg split. That's P R E G underscore split and basically use it the same way. I guess you would type something like this. In fact, I've never used it before. Let's see what happens when we type this underscore split. And supposedly that's like the other split also accepts regular expressions. So you got to be careful how you put stuff in there because it may think that it's something that it's not. Nope, see that still doesn't work. Once again, I've never used this before. Supposedly if you learned how to use it, it's like split only faster. That's my understanding of the difference. So really from what I've read, using split is really never needed. Because I guess if you're using it in newer versions of PHP, you should be using this type of split rather than the regular split. But I mostly use explode because at least for what I mostly do, I don't need regular expressions. But if you're going through a large file that has a lot of different things that you might need regular expressions, but that's beyond this tutorial. So we will undo stuff like so save that refresh and we're back to how we were before. Now we're also putting this into a list. And if you remember from our last tutorial with split, we also put it into an array and you can do the same thing in this case. Basically, instead of putting a list, which is probably more useful in a lot of cases, in my opinion, we can say we can say dollar sign names. And now instead of having F name, L name and OP for occupation, we have names zero, names one and names two. And if I did everything right, the output looks the same, even though the code's different. We can even look at the HTML looks the same. So that is definitely another way to do it. All depending on what you're trying to do. I think in most cases what I use it for, I probably would use the list that way everything's named the variable that corresponds with what it's holding. So that is the explode command. And once again in the next tutorial, we'll probably using the explode command along with our first tutorial, which we went over in this series. Once again, there should be an annotation for the entire playlist. But the reading files line by line and splitting those up. So that's what we're going to work with in the next tutorial. So I hope you look forward to that. If you're enjoying these tutorials, please give these videos thumbs up and comment below. Let me know and we'll have more of these coming up. And this is all once again the we're working with server side stuff here. Other tutorials I'm having during the week are with jQuery. So client side stuff and other JavaScript stuff. And soon we'll be putting the two together to make full blown applications, which can package together either in my opinion. Most of the time you should just run them from a website. But if you wanted to package up into a application for a phone, I'll go over Android devices or package it for Linux or Windows. I don't have a Mac machine, but some of the techniques will work for that as well. So basically you'll be making applications that will run on pretty much anything. And it's just if you don't want to load them in the browser, it's just how you package them, which is really all programming. If you write a program right should run on all operating systems. As long as you go through the effort of packaging it for different operating systems. So I thank you once again for watching. Sorry for my babbling at the end there. I hope you enjoy the tutorial. I hope that you have a great day. Visit my website, Filmsbychrist.com. There should be a link in the description and that is Chris with a K. Have a great day.