 So, as always, my talk is online, talks.php.net, Singapore 18, this time, Twitter at Rasmus. I'm old. I've been around for a long time. This was my first computer. For some of you in here, this probably looks more like a calculator, but this thing had 1K of RAM. The box at the back here is actually a memory expansion module that added 16K, so I had 17K of RAM in this beast. It seemed like a lot at the time. I didn't know what to do with all that memory. But now, if you think about it, it's 17K of RAM. I mean, all the selfies you guys have been taking with me are like 5, 6 megabytes, right? The difference between then and now is astounding. I had a VIC-20, Commodore 64, Hayes Modem. This was how I connected to the internet. There wasn't an internet, but to BBS's and things back then. So this was my world growing up, sitting there and waiting for Z-Modem to download stuff for hours and hours and hours. In the 90s, I did a lot of stuff with Gopher when I was at university in Canada. This was the closest thing we had to the web in the early 90s was Gopher. It was mostly for academic papers and things where at the bottom you could link through references. It was text-based, but you could cursor down and you could click and you could go and read the reference to this particular paper. So Gopher was quite heavily used in academia, but outside nobody knew what it even was. The world changed for me in 1993 when Mosaic came out, the first graphical web browser. This was when I looked at it and said, okay, this is what I want to do. This is going to change the world. And this wasn't any great insight on my part. Everyone could see that this was going well, not everyone maybe, but lots and lots of people as soon as Mosaic came out, saw that this is going to be special. So that was when I started PHP. In the early days, I wrote tons of code that looked like this. So C code with HTML embedded in it, and I got very tired of writing code this way. And I was writing the same code over and over again, so sort of the same template C code from one project to the next. And if you just wanted to make a slight change to the HTML into the layout, you have to recompile and redeploy your C code to your server. That was just not a good way of solving the web problem. Most people started using Perl, something called ModCGI. To me, this was just sort of a slightly shorter way of doing the same thing, and it had the same problems to me. Here they've abstracted away HTML, so you had to know how to do it within this particular module. You had to know that you had this H1 function, for example, in order to spit out an H1 tag. I didn't like it at all. I didn't like programming my HTML. I wanted to be able to have other people do the simple stuff, the layout and the look and feel and to make nice looking pages. I just wanted to provide the back end logic for it. So basically what I wanted was HTML with some server-side logic access directly from the HTML template. So this was early PHP. I didn't actually have the closing question mark here, but for the syntax highlighting it, it shows up better when I have it. Back then it only had the beginning, the opening question mark, because I didn't fully read the spec, the SGML spec behind it. I fixed that later on. It took a while. This was my aim. My aim was a very simple templating system that would let me make calls into my business logic scene. I got it completely wrong because I thought the world would want to write heavy business logic in a compiled, statically typed language. Nobody agreed with me. What I wanted was for people to basically expand my templating system with their own set of tags, and those tags, the code behind them would be written in C. What I put out there was the basic C API to talk to web servers and to do all the basic things, read the post data, handle cookies, all the templating stuff that you have to write yourself every time. I provided for you and I said, okay, here, plug in your own set of tags. Just add your own C functions here that implements your particular business logic for your site. Then I had a very simple templating system that let you put these tags into HTML and it would parse the HTML and then call those C functions. I put out some sample applications like a guest book and various things like that. People said, this is great, but I see you have an if condition, but there's no else. Can we add an else to the templating system? Okay, now we're getting into business logic here. That should be in C. It's not business logic, it's still just display logic. Then they started asking me, well, what if we want to use the same block many times? Can't we have loops? Okay, let's add loops. Then I said, well, it would be nice to be able to sort of group our tags in function calls. How about function calls? I was like, okay. Slowly but surely, they tricked me into writing a full programming language as the templating system. I kept trying to convince people, no, you're writing, this is not business logic anymore. I went to their websites and I looked at some of their stuff and they would send me bugs and I could see their code. It's like, you're writing all your business logic in the templating system. Are you nuts? I basically had the whole industry miscalculated. The web was growing so fast and there simply weren't enough C developers in the world for the growth of the web. What they wanted was a very, very simple and easy to use templating system that they could just take existing HTML and make dynamic. They didn't want to write C code. So eventually, after many years, they convinced me to say, okay, fine, let's say it's a programming language but I was extremely reluctant for years and years to even admit the fact that it was a programming language. It wasn't supposed to be. It was supposed to be a templating system that let you write C code. However, be that as it may, here we are. Many, many years later, 25 years later at least, we now have PHP 7.3. This looks nothing like the first versions of PHP that I wrote. And everyone in here who's giving me all this credit for giving them jobs and all this stuff, it's not me. It's lots and lots of geeks over time that have taken my idea and made it tens of times better. This is so much better than anything I could ever have imagined. So some of the changes in 7.3. We have a flexible here dock now. So you don't have to have your ending terminator in the first column anymore, which was kind of wacky. So now everything, the number of spaces or tabs or whatever you use will be deleted from the contents of it. Whatever indentation you put on the ending thing will be removed. So in this case, it'll just have bar on the line by itself. It won't have the spaces even though it's indented in your code. Hopefully that makes sense. This is just about the only place in PHP where white space is significant. But it is in this case. For a good reason, I think. There's a new warning. This is kind of a weird edge case. People who put a continue statement inside a switch case. What does that actually do? So if you're in a while loop and you have a switch case and you do continue. I think some people think that's going to continue the loop. It doesn't actually in PHP. It's actually like a break. And this has caused some bugs for people. So now there's a warning that says since you're not using a break or using a continue, maybe you meant to continue to in this case because that will continue the loop. Otherwise you're just breaking the case here. You can now use references and lists in the listing text of both lists and also the shorter square bracket form of it. You can use references. So in this case, B would end up being a reference to two here. You couldn't do that before. In earlier versions of PHP 7, we added the ability to have trailing commas everywhere. Everywhere we missed one spot which was in function calls. Now you can do that in 7.3. You can have a trailing comma. Not in all cases. But in this case here, you can have a trailing comma. There's also a new monotonic timer function called HR time. So a monotonic timer is a timer that always moves forward at a constant rate. So even if say the system administrator changes the time at the root level on the server or if there's a leap second or anything like that, that actually changes your system time. If you're not using a monotonic timer, sometimes your clock in your program, as far as your program is concerned, can go backwards. Summertime, things like that. There are times when the system clock changes on you that can cause real issues if you have some timing sensitive code that's relying on measuring. If time suddenly goes backwards, bad things can happen. A monotonic timer can never go backwards. Those of you using FPM, there's a new FPM get status function that turns a huge associative array. So an overall and then for each process that you're running, it'll let you know what it's doing, the process ID, the fact that it's running, how many requests it's had, what the last request was on it. It's a lot like the Apache scoreboard or like server status on the Apache web server. You can now get that for PHP FPM very easily. There's also a new is countable. This is one of the things I was running into at Etsy when we're upgrading to PHP 7.2. Because PHP 7.2 is quite a bit more... It's more strict about what you can count. So if you're trying to count things that aren't countable, so if you're calling count on a non-array or non-array access or countable object, you're going to get a warning now that says that this thing is not countable. In order to get around those, before you had to do some checks, is it an array or is it an instance of countable? Then you can call count. Now there's a new function in PHP 7.3, so you can just call this countable on stuff and it'll let you know if this thing is countable. You should know already, but in cases where your code is very dynamic, where you're passing random types everywhere and you need to check, you can do a countable check. Two new array functions. Key first, key last. A lot of people were using reset and end to get the first and the last element of an array. The problem with that is that it moves the array cursor and it also... Since it modifies the array cursor, you couldn't do it on things that didn't actually have an address. We couldn't do it on a real array. You can't modify this thing. This one is a read-only. Get the first key, get the last key. Another new thing in 7.3 is the DCE and SCCP that we started introducing in PHP 7.2 has gotten a lot more interesting. And I'll cover that separately. Some other changes. We're now using PCRE2, which is a regular expression library. There's a new major version of it. It shouldn't break anything, shouldn't. There are some edge cases where in really weird regular expressions, it might behave differently. So if you do upgrade to 7.3 and you find yourself with test cases that are failing, check if that test case has a really complicated regular expression and see if some change in PCRE2 might have broken it. Some other things. Get all headers. One of the things preventing some people from moving away from mod PHP with Apache to PHP FPM was that they couldn't get all the request headers easily. That's now available for FPM. Some stuff for MB string. We also escape the hash now in PREC quote and a couple of other things. So things that might break your code. If you upgrade to 7.3, PCRE2 could, should be rare. I haven't found any breaks. So I manage the code at Etsy and we have millions and millions of lines of PHP code. This particular change didn't break anything for us. But it depends how weird your regular expressions are. If you're relying on old UBC router or bird step, and most of this room, I would say pretty much everyone in this room don't know what that is. Great. You don't have a problem. And there are some various deprecations that will throw some warnings and notices. So see the upgrading document please. For all the, I just gave you highlights. There's quite a bit more things. Please read the whole thing. If you're writing extensions, check the upgrading internals document where there are some hints on what has changed internally that you might need to go back and fix your extension for. So, most of you know, as one of the things I talked about last time I was here was the huge performance boost of PHP 7 over PHP 5.6. You can sort of see the progression year by year by year as we're going. But 7.3 actually has a little bit of a boost. It's nowhere near the big jump from 5 to 7, obviously. But it's pretty good. If you're still on 7.0 or 7.1, 7.3 is going to give you a little bit of a boost, probably 10, 15 percent, which is pretty nice. And latency has dropped as well. It's not a lot, but here, PHP 7.0, 47 milliseconds latency on WordPress 498, down to 38 milliseconds. That extra 9 or 10 milliseconds is nice. Gives you a bit more headroom for other crazy things you might want to add to your site without blowing your SLAs. If you have latency SLAs, I do. You should, too, actually. That should be a test failure. If your pages start getting too slow, it should fail. And you should be debugging at the performance level, not just functionality, but slow sites kill you. So keep paying attention to that. And you can buy yourself some time by keeping PHP upgraded, because we're always going to be faster with the new version. Well, hopefully, 7.4 has tight properties, which is going to hit us a little bit, but I'm hoping Dimitri can come up with some magic and still make 7.4 faster than 7.3. Right now, 7.4 is slower than 7.3, but it's very, very early in the lifetime of 7.4, so I hopefully will overcome that slowdown. Memory-wise, PHP 7.0 is awesome. It uses a fraction of the memory that PHP 5.0 does. If you're still on PHP 5.0, you shouldn't even be in this room. You should be at home, at the office, upgrading. There's no way you should have time to be sitting here, because it's crucial. Get off of PHP 5. Get onto 7. It's better for everything to do that. It's better for the planet, too. Do a little bit of math on it. We have around 2 billion sites on the web, 10 million physical machines, PHP is on about half of them, roughly. And I think last time I was here, I talked about 5% PHP adoption, PHP 7.0 adoption. We're getting close to the 50% now. We're not quite there. We're a little bit under 50%, but around 50%. So about 2.5 million physical servers. And by upgrading from 5 to 7, well, this is about what it takes running a server, like 3,000 kilowatt hours a year. In the U.S., it costs about $400 to power this thing, and then you double that to cool it. So it's about half a kilogram of CO2 per kilowatt hour, right? So at 50% adoption, this is what we're saving, about $2 billion a year, by switching from PHP 5 to 7. But let's get to 100. It's good for everyone. So please, upgrade to PHP 7 if you haven't already. Like I said, PHP 7.3 has much better DCE, Escape Analysis and SCCP. This is one of Dimitri's babies he's been playing with for the last couple of years. And it's pretty fun stuff. You should go, and if you're interested in compilers and optimization and things, go have a look at this DCE and SCCP code in PHP. It's cool. I'll show you some of the things it does. So in the very, very simple case, it can eliminate stuff like this. So if you have a function, set A equals to 1 and return 0. Obviously this assignment is completely useless. It doesn't do anything. Variables in PHP functions and methods are not global by default. You have to declare them global, right? So this is a local variable that is not used. It's useless. In PHP 7.1, if you dump the actual op codes that gets generated, and you can do that with this fancy looking line, you see that it generates the op codes that assigns $1 to A, and then it returns 0. In PHP 7.2 and 7.3, it doesn't even create that op code. So it just says, well, I know this thing doesn't do anything. I'm not even going to include it in the op cached version of this code. So what's actually cached in the op cache, which is what gets executed on every request, it's as if you didn't even write this line. It just disappears. PHP deletes it, right? You can try to trick it, and this is where PHP 7.1 generates a ton of op codes on this piece of code here. The trick is that you're getting a bunch of inputs into the function. Assigning all those, you can concatenate them together, putting them in X, but then you wipe out X, and then you return X. These ones are actually no ops. They don't actually do anything. This is just indicating which internal variables the four past arguments end up in CD0 through 3, and the optimizer has figured out that these two lines of code, never mind even the assignment X equals 0, even this isn't used. You can see the generated op code is just return 0. So this entire function is reduced to return 0. There's no concatenation, there's no X variable even, just to return 0. And as you can imagine, this set of op codes runs quite a bit quicker than this set of op codes. You can try to trick it. B equals A, plus equals 3. This is valid PHP. This assigns both A and B to the same thing here. Return A. But here PHP 7.2 and 7.3 are smart enough to figure out that this B assignment is completely useless. So it adds 3 to A and returns A and just deletes this part of your code. Now here's where 7.3 starts getting smarter than 7.2. So if you look at this code, I'm passing in X and Y integers. Then I'm creating an array that contains X. Then I'm setting A1, so the second element of the array I set to Y. Then I wipe it out, A equals Y, then I just return A. Obviously in this case, sorry, if I scroll this slightly, all we really knew is these two last lines, right? A equals Y, return A. And here the optimizer in 7.2 wasn't quite smart enough to figure that out. In 7.3 it is. All right. So the escape analysis part of this I think is really cool. Take this little snippet of code, class A, function through new A and you set it properly in A equals X, return X. PHP 7.3 just deletes it all. This code doesn't make any sense. I'm not going to compile this at all. All I'm going to do is I'm going to create a function that receives an argument and returns the argument. It has seen that there's nothing happening here. This A object doesn't do anything. It doesn't have a destructor. It doesn't have anything that can escape from in here. So it looks up a level, the optimizer in this case, and sees there's no point in object A. Let's just ignore it completely and just generate these op codes. However, if you add a destructor, then suddenly there is a way that something can escape. So in this case, if A has a destructor, it means that when the A object falls out of scope of the function, some external code is going to run that could have a side effect. So in this case, the optimizer is smart enough to say I can't delete this object and it leaves everything in place. Now, maybe a future version will also know that, hey, this destructor doesn't do anything. But right now, we're only looking up one level. We're not going deeper into those levels. So here it just says there is a chance that something might escape, so I'm not going to optimize this away from what I think is interesting. So here we're passing in an integer, right? So if X is true, then we're setting A to the array 01. If X is not true, the passed-in integer, then we set it to 02. Then we return the first element of the array. Now, in this case, it doesn't actually matter what X is, because it's always going to return the first element and the first element is always going to return 0. So this thing is always going to return 0. And the optimizer is smart enough to figure that out. It looks in the contents of the array and says, hey, this function just returns 0 no matter what's happening in it. So that's all we're going to make it do. That's really cool, because there's a lot of branching and a lot of checking and creating arrays and stuff that would otherwise have to be. We'd have a page of opcodes in this particular case. And it just reduces to 1. Return 0. You can try to follow along, but the optimizer has determined that all this code does is echo 1, return 4. Forget all the other logic. This is all it actually does. So that's what we're going to cache in the opcode cache. What this really means is if you upgrade to PHP 7.3 and your code is dramatically faster, your code sucks. Because you're writing code like this. If you're getting a 50% speed increase, it means that the optimizer eliminated half your code. You're writing tons of redundant code. Decent code, you should see 5% increase, maybe. Anything more than that is sort of an indicator that your code is terrible. And I wouldn't post it all over Twitter saying, PHP 7.3 is great. I got like 100% speed increase. Because people will look at you like, aha, okay. And it might be true, but it says something about your code. So, one of the things that can help you a lot with your code quality and also to upgrade things is static analysis. I started a static analysis project a couple of years ago, called it FAN. Very unimaginative. You can get it from GitHub. FAN. Easy to install with Composer. Composer require dev fan fan. You can create a config. It depends a little bit of your layer of your code, but for sort of a standard Composer style project where you have a source directory with your code and a vendor directory with all your Composer packages, you can set it up like this. You can say, this is the directory I want you to analyze. I also want you to include all the stuff in vendor, but don't give me errors about it. Just include it so I have all the object references and all the prototypes and things, but don't give me errors about someone else's code. So in this case, just stuff under source would actually report errors. And then you run vendor bin fan and it'll analyze your code and usually spit out quite a few errors for you. You can also further hone or configure your configure file here to say only certain types of errors are things you're interested in. Because by default it's a pretty long list of very common mistakes. It's interesting to read, but sometimes if you're adding it to an existing project, there's just no way you can fix them all. So you can tell fan to ignore certain types of errors. So some of the things it checks, it checks way more than just this, but it does all of these. It also lets you do enhanced PHP type annotations. So here we have a function fn that takes a variable called union which is not typed at the PHP level because it can take either a string or an int. And PHP itself does not support union type. So you can't add a type here. So this is where a fan type can help you or PHP doc type. We say this can be either a string or an int. PHP does allow you to say an array, but it doesn't let you tell it what type of array. So here a fan can be used to say this should actually be an array of integers. If you pass me an array containing anything other than integers, show me an error. And you can also have a shaped array. So my third argument here is a shaped array that says this is an array that has to have a key named mode and a key named max. And the values for these two has to be string and int. So that's getting very specific. Right? That it has to have these two particular keys for it to be valid. So then if we try it this first one matches all of it. The first one is a string which is good. This is an integer array. And this one has both mode and max. So that passes no problem. This one as well passes nicely. What do I change? Oh yeah. I made an int here. So this shows that it can take a string and then this one I reverse the order. It doesn't matter the order of the keys. Arrays in PHP are ordered. But in terms of this it just means it has to have a mode and a max key doesn't matter what order they're in. Now we start getting mistakes. So here I'm passing in an array of integers in the first argument. And fan comes up with this error. This says argument one, which is union because that's the name of my variable here is an array but it takes either an integer or a string. So it's quite verbose. It tells you exactly what's going on and exactly the mistake that you made. And then in this case I'm passing in an array but I don't pass in an array that has mode in it. And here again we get an error that's quite precise that says this is the shaped argument and you're passing in just max 10 but it takes an array that has mode and max. So that's the type of errors you can expect to see from fan. You can also write plugins that comes quite handy to for a large project if you have a company that relies heavily on PHP writing plugins that figures out some of the very specific quirks of your code can be very very handy. We have a custom ORM for example at Etsy that creates these dynamic objects that there's just no way to statically analyze without knowing how that object creation and how that object naming is done and we have a plugin that figures that out for us and you can use some of the example plugins as a guide. There's also a daemon mode which I think is pretty cool that lets you hook this into your IDE or even just your VI text editor and have it spit out errors very very quickly on demand. So if I pop over here to my fan demo so I have a source directory basically I have it set up the way I set it. I have a source and a vendor directory I have a .fan config file that just is set up like this source vendor. If I run fan it will find these errors that I showed you. It's the same file I just showed with the shaped and union stuff but I also have a little test script in here that's very very simple. It takes an integer and I call it with an integer. Now if I change this and I pass in a string and I try to save my file oh I didn't notice that sorry thank you not quite there ah it moved on me. So when I try to save it I get this VI error internally that says right there right when I try to save the function takes an integer right and then if I go back and I fix it now it will let me save it nicely with no errors right now you don't need to hook it into your editor like this but it's kind of cool to get PHP storm functionality in any text editor do you want and in order to do it there's various scripts for various editors. There's this fan client that you just run it's not on my path it's on my client that you hook in the VMRC so here I don't see it it's off the screen but you can go look in the documentation for it it's very very easy to set up so Daemon mode is cool I have a little video that basically does the same thing for people who aren't at my talk now next cool tool is called PHP Spy this was stolen from the Ruby community in a sense because they have an RB spy function that I think is pretty cool so it's a co-worker of mine at Etsy and Daemon that wrote it it's a very low overhead sampling profiler and what it lets you do is sample an already running PHP script and see what is this damn thing doing it doesn't have to be already running you can also just run one so in this case here I'm saying sample every 200 milliseconds it's in nanoseconds so you have to kind of count the zeros so this is 200 milliseconds so every 200 milliseconds take a sample and the script I'm running is just sleep one so you can see the output five times I get a stack trace that says main sleep right so because this thing is sleeping for one second and I check every 200 milliseconds that's what I should expect to see every 200 milliseconds I check I'm still in sleep done so that's the output from now now this is obviously not very useful but it's to show you exactly what this thing is doing it's checking what's happening in this program and you can attach to a running one so here I had some PHP FPM processes while I was benchmarking WordPress I attached PHP spy to it so peak wrap minus N I just grabbed one of the process IDs for PHP FPM minus P says I want to grab this process and you can see some of the stack traces I'm getting back so at the first check and by default it's every five milliseconds that it'll check so in the first check here I was in the load PHP second time I was somewhere in WPDB which is the database calls which it spends a lot of time in those but even this how do you read that what are you going to do with this information it's just a bunch of stack traces so what you can do and what PHP spy comes with is a stack collapse and the flame graph that generates a flame SVG so I ran this against fan in this case so when you're running a long fan analysis and this is what I got out cool flame graph where it can click on things and zoom in and I can see okay so this thing took quite a while let's go and zoom in on this part and then you can go and look at all the individual things so here's a post-order analyze we ended up calling this thing here and basically what we found it really really useful for at Etsy is we have a bunch of gear man things we also have some cron jobs that run in PHP every now and then one of these just runs forever and it's really cool to be able to just PHP spy minus P that process and then looking at the flame graph and then seeing ah okay this thing is spending all its time in this database call because that particular database is overloaded and slowing everything down so it's like attaching GDP to it and trying to do a stack trace except it's a much much nicer way of doing it because in GDP if it's hopping between three different things it's just by luck if you catch the right one with a flame graph you can see how much time is spending in all the different parts of the code and if it's not what you expected it gives you a lot of information on how to where to start looking for the problem in that code so I really like PHP spy especially because you can just run it on any you don't have to build it special you don't have to have debug symbols or anything in it it just kind of does its thing alright so I've left a little bit of time for questions hopefully I can't quite figure out our schedule I think I started quite late but a few questions at least what's my timing like random okay we can also leave all the questions for the Q&A today if you want let me take one or two on specifically some of this stuff because we might want to use the time later for other stuff any questions on this stuff yeah in 7.3 optimizer you said that the class would not get cold at all what if that class has some side effects right creating a file or opening a database connection or something right correct so in this particular case and I showed that in a particular case the class has a potential side effect right so in this one I know it doesn't because the class is empty no but the A constructing an A can have a side effect there is no constructor this is the class okay so that's what I was showing basically the difference between this slide and this slide is that I added a destructor I could also have added a constructor but that's how we know there's no constructor there's nothing in the class that could possibly cause a side effect then we can remove it now it's very rare granted it's very rare that you have an empty class like that but there are times where there are weird dynamic ORM things that have empty classes for stuff and when they aren't filled in it's nice that the optimizer can get rid of them others really maybe all they need is coffee one at the back oh that's Derek he doesn't count do you want a question or not okay okay so how does PHP Spy actually get to the data how does it do that basically the same way GDB does in a sense so not quite the same it's like a smart GDB in the sense that it knows the addresses of special things inside PHP so when you compile PHP Spy it has built in for the various versions of PHP so if you look at so we have offsets so if we can find the bottom address we know at which offsets all these various things are which is why you don't even need debug symbols which means it can figure out what's based on where things are in memory it's quite magic actually it's really really cool magic but it is a bit so if you change your PHP version you need to recompile PHP Spy for that particular version that you have installed you have to just remember that because it is version specific it needs the right symbols and the right offsets for it to work yeah Patrick once you don't need any extension existing on PHP side for PHP Spy yes now you don't need anything okay so it's fully magic when do you have when do you have overhead only at the time you are going to so there's going to be overhead in the same sense that when you try to S trace a running process it slows it down a little bit it's not Valgrind sized overhead because there's no virtual machine or anything it's not Valgrind sized overhead so yes but normally when you're desperate enough to run PHP Spy on something that's running wild you don't care about a 5% slowdown of this thing that's already taken forever you just want to know what the hell is going on with this particular piece of code so in that case it is very very low overhead but there is a little bit you're right when you're talking about the new compiler you had a command line can you show that okay so this first part here so minus D sets I and I options you could put some of these in the I and I file as well but this sets optimization level to negative 1 that first means turn on everything because it's a bit field and minus 1 in the bit field turns on all the bits so I'm turning on all the optimization levels then I set the opcash optimization debug level so this magical hex value this magical hex value is the please dump the opcodes after optimizer has run and then the script would be the that would be the file you want so if this wasn't a file named script for example I can show you and how would you export it to a file so I'll show you so let's go into my fan demo directory oops and in my source directory I have our little test.php so we just go like this and we run it on test.php and we get this now in my slides I had cut out the main part in most of them so here we see two blocks we see main that's not inside a function or a class right all this does it basically initiates a function call right remember my script is test fn1 this is in the global scope right so that's this part up here and then my function test fn is here so that receives an argument and echoes out dollar a and returns null so that's the entire set of opcodes for this function and it's just running it from the command line okay so usually I work within a large framework so I work in Drupal and it has like thousands of lines of codes and methods and functions but you can still dump the opcodes for any particular file right and then you can grab that if you're interested in a particular method just grab the output and find it'll say in the left column the name of the method then grab and look through and see what's there okay thanks it is quite handy I mean when people ask me questions at Etsy for example it's like what's faster should I do this or should I do that like there was a question the other day someone was saying let's see the question was something like this dollar a equals 17 should I do not not dollar a or should I cast it to a boolean dollar a right because not not something this is equivalent to casting to a boolean and he was saying which one is faster has not not been optimized and the easy way to answer that question shut up fan the easy way to answer that question is just to dump the opcodes and here you can see at the opcode level PHP doesn't care if you use not not or boole a boole cast the optimizer ends up or the compiler compiles it to the same set of opcodes so not not and the boole cast are identical in every single way you can imagine other than readability right but the generated code is identical for those two particular operations so it's a really good way of settling arguments as well which is faster right because I mean if it was like hacker news or something there would be a massive thread on which one of these two is faster because not a single idiot on that site knows what the hell they're doing right so this is how you answer questions like that this is definitive the answer you can't argue this others so the question was what's new in 7.4 we're still working it out so the latest thing that passed was type properties so that's the main thing right now we have in 7.4 and type properties just means you have a class property you can now add a type directly to it we have tried it before but there's always been performance limitations because every time you assign something to that property you need a check and that's not something we traditionally have done in PHP on variable assignment we don't want to run additional checks because that slows everything down type properties is sort of limited enough that it's not as bad as doing like type variables everywhere because that would really really be a performance hit type properties aren't set as often as variables or incremented like in a loop usually or anything like that you usually don't have like at this I and that's your loop counter right if you did in 7.4 that code is going to run the hell of a lot slower as opposed to just a local dollar I loop counter right so don't do stuff like that in the future before 7.4 it wouldn't really matter we can increment a property just as well as a local variable the same amount of time that's going to get slower in 7.4 but because of the nature of properties we can get away with it I hope without too much of a hit other than that if you are really interested in keeping up with what's happening go to where's my URL bar one second go to wiki.php.net flash rfc and you'll see the collection how did I get to oho what the hell is oho typing in front of everyone it's a bad idea don't I have it here yeah there it is okay so go to wiki.php.net flash rfc and you will see some of the proposed rfc's always available hash extension that's basically just moving the hash extension from being optional to being sort of built in at all times you can see there's some things under discussion removing WDDX some namespace visibility stuff fibers I don't think we'll see it for 7.4 so fibers is a way of doing multitasking that's going to take some work that's probably an 80 feature but some of these other minor things are likely to come in 7.4 not all of them and down here you'll see a list of past things and hopefully the Jesus some deprecations you can read through that just have a look through this site it's way too early for me to stand up here and give a definitive list of 7.4 features it's going to change a lot in the next 6 months you guys need to cut me off when you want to maybe we can hold it after the talks and everything thank you