2:PHP Alive and Kicking With Sara Golemon

## Metadata
- Author: [[YouTube]]
- Full Title: 2:PHP Alive and Kicking With Sara Golemon
- Category: #articles
- Document Tags: [[video-notes]] [[youtube]]
- Summary: 2:PHP Alive And Kicking with Sara Golemon
- URL: https://www.youtube.com/watch?v=D3FZr0ItziE
Hello and welcome to PHP Alive and Kicking brought to you by PHP architects and made better by our partners at Honeybadger. More about them later. This podcast explores the latest developments in PHP and what it's like to earn a
living as a PHP developer today. I'm one of your hosts, Mike Page, better known as Mike Page Dev, and I'm a developer at PHP Architect and sometimes a lighting and sound technician. My co-host is a longtime contributor to our magazine and now fellow team member, Chris Miller. Today we have a guest as you may see the uh I did did joke last on the last
show that uh you are the one of the loudest voices in PHP but I don't believe you've actually written any PHP. I might be wrong there though. So why don't you introduce yourself? >> Okay. Okay. Okay. I've written some PHP. I'm not like, you know, PHP is dead pearl for life. Okay. Um, hi everyone. My name is Sarah Goldman. I have been you actually uh using PHP since the late 90s. Um, not as much
recently. Yes, because I have not been doing as much web development. Um, been doing more backendy stuff, but I'm still definitely involved in PHP. I am a member of the PHP Foundation board. Uh, I was on the um, oh my god, I've forgotten the name. This is embarrassing. The the ones that make the PSRs. Um, >> yes, them. >> Oh my god, I can't live. >> How do you not remember that name? >> What? Oh,
I'm going to be raked out with gold for that one. Um, yeah. What is PHP? I don't know. I don't think I do it. And I don't think I have a loud voice. And I will shout you down if you tell me I do. >> Point proven. >> So tell tell us how >> I just want to be heard. That's all. >> We understand. We understand. And I don't don't mean it in a in a in a mean way. It's a >> of course >> endearing way. So >> leave that to me.
>> Tell So tell us h how did you get into PHP? Um yeah. Well, like I said, um since the late 90s, um one of my first real jobs um out of um almost going to school, but not quite uh because things went kind of weird in my late teens, early 20s. But um I wound up actually working for the US government of all things. Um under Clinton, I want to point out, not under anyone else, and
that's as political as I'll get. Um, I was working for the US courts in the Northern District of California just doing, you know, tech support stuff because in the late 90s you didn't have to be that smart to do tech support. You just had to knew, you know, make sure the computer's plugged in. Uh, reboot it once in a while, maybe update McAfee. Um, I mean, I did a little more than that. Um, I actually had a decent amount of network under my belt for stupid reasons. Um but then uh our our department's programmer uh got promoted
to the head of the department because the head of our department was in an unfortunate accident and you know downers over there. Um so they're like hey you you have some experience with programming right? And I'm like uh I know basic and I took a couple of courses on C during the semester of community college I did. Sure why not? Um so that got me into writing ASP which was you know one of the few web
programming things you could do in those days and like 6 months into that um my boss who again was the previous programmer for the department he's like hey why don't you check out this PHP thing this looks pretty cool and this was like 98 so like this was like 3.0 0 I think 16 was the the patch version at the time, but like it was it was early PHP. Um, but the thing that made me fall in love with the language was actually the website. The documentation was incredible. Like from day one, PHP's
documentation was second to none. Um, and there was this little yellow JavaScript search box that would pop up when you hit on the search button. And I thought that was cool as hell. Um, and turns out that was JavaScript and not PHP. But, you know, whatever. Um, fast forward 30 years and here we are. Um, I I I got into IRC to um kind of like rubber duck my own problems as I'm running into them, but also kind of help
people with other things, you know, community stuff, basic 101. And um I somebody ended up asking how to like take a logarithm of an arbitrary base which PHP had a function for base 10 and neparian log logarithms but not arbitrary bases. And I'm like well that's just math you know just just log this and log that and divide and you're good. And I'm like well why not do that natively? So, I started digging into the source code and I'm like, "Oh,
here's where this goes and here's where all these others are like how they're taking parameters." And I just kind of like worked it out from first principles. I'm like, "Oh, oh, hey, PHP dev list, would you like this patch?" And they're like, "Yeah, sure. Why not? Whatever." Um, and then that encouraged me. And then I did started doing some more stuff. And like two or three patches later, Derek's just like, "Just just make an account. just push your own stuff. I don't want to be approving your patches all the time. Um so and and that was all you really needed to do to
contribute to PHP back then was just be annoying a little bit. Um so yeah um here we are another 25 years after that. >> You're still writing patches, are you? um from time to time. I haven't written as much lately because um Facebook um who I was with from about 2010 to 2016, they had me working on HHVM. Um which you may know is kind of what pushed PHP
to get better. Um I I'm not saying Facebook deserves all the credit, but uh HHVM was like twice as fast as PHP 5 and PHP had to be like, "Oh uh pardon my French. I don't know if this is an explicit podcast. Um, >> it's not now. >> HBM's eating our lunch. We better loudest voice. Um, we better step up our game. And so that's when Nikita did all the work that he did to make PHP7 pretty awesome. Um, and now twice as fast as
PHP 5, in fact. Um, and where is HTVM? They're doing whatever they're doing. Um, where was I going with that thought? Um, uh, oh yeah, last time I was really writing PHP on a regular basis. So like I ended up rewriting most of PHP's runtime in PHP um because the way HVM works um the JIT can compile PHP code uh on startup uh out of this what they call
the system lib and then because it's in jitted code you don't have to trampoline between user space and internals which makes it actually a little bit faster than the way PHP is doing it where you constantly have to switch contexts save registers do a bunch of weird stuff. Um, and so that was probably the last serious bit of PHP I wrote. Um, before I uh because I went to after that and I was only working on the database server, which is just all C++. Um, all the tests are written in JavaScript. The build
stuff's written in Python. Um, it's none of that's PHP. Although I would I would still sneak in a few scripts here and there. Um, sometimes you'd need, you know, a one-off to let's grab all these YAML files and reprocess them into something else. And what can I do that the fastest in? I can do that the fastest in PHP because you throw stuff at it and it sticks. But, uh, yeah, the last thing I wrote that went into PH well that could go into PHP is um, composable functions. uh
Larry uh Garfield Krelll who uh introduced the pipe operator and we'll probably talk about that later. Um he also wants um this idea of composable functions where you can take a callable and just add it to another callable and then maybe add that to another callable and it'll create a chaining set of callables. So you can do something like uh you know uh UC first plus stir to lower plus stir rev and it'll pass a single string through all those functions. Um, so there's a pull request
sitting somewhere waiting to see what happens with that. Um, he's he's working on the RFC because I don't want to write the RFC because that's really boring. So yeah, so I'm I'm I'm still doing PHP stuff. Um, I'm in the I have two monthly meetings related to the foundation. So, um, all of our active developers, there's a meeting on the last Monday of the month where we talk about what everyone's working on and, um, what the plans for what's coming next are and that sort of thing. So, I I stay plugged
into that. Um, and then there's the board meeting on Tuesdays, uh, where we make, uh, decisions about what we want to do with um, future projects. And there's one coming up that I can't talk about yet, but um, I will uh, you know, when I can talk, we can talk about that in the after show. Okay. >> Well, talking about the foundation, for for any listeners that don't know what the the PHP foundation is, why don't you just give us a bit of an overview? >> Well, why don't you know about the PHP
Foundation yet? PHP is building your career. No, sorry. Um, the PHP Foundation was launched a few years ago. um Roman uh Prsky of the of Jet Brains um sort of led this effort and it the idea is it is an organization which um helps fund the development of PHP. So PHP for you know its almost 30-year history has been driven entirely by volunteers who use their spare time to
make PHP better and it's done very well for that but um there's been a couple what problems? One is just bus factor. Um very often you have like a handful of people who are doing a lot of the work and like uh Demetri Stogov was doing a crap ton of the work. Um Nikita Papa was doing a crap ton of work before he left to work on LLBM. Um and so you have this shrinking bus factor of people who really know all the inter interior bits and pieces really well. Um and so we need to increase that bus factor and
make PHP more uh stable long term. Um, we also just need people who um are spending more of their time than just their free weekends or whatever making PHP better. You know, we need we need like serious attention on it or we don't need but it would be really nice if we had serious concerted attention on that. Um, so yeah, if you go to um I should have grabbed the URL first. It's on Open Collective. I will make sure to get the correct URL so that uh
one of you can paste it in down here. Um or maybe one of you can look that up while I'm talking. Um open collective something/php foundation something close to that. Um that will tell you not only how you can donate yourself but like who else is making donations, who else is helping to support this. And so we actually have a a decent budget. Um we we pay several developers uh on a monthly basis um for their time so that they don't have to be have a full-time
job to pay the bills plus working on PHP. Um and um I think as end users you might have noticed the development of features has sped up over the past few years. Um and that's been a mixture of these paid developers plus you know we're still getting um contributors. I mentioned Larry earlier. He's not being paid by the foundation. he's doing this stuff because he thinks these are really cool features and they're really useful for the language. So, um, and other people as well. I didn't want to just pick one of him, but he was he was the one whose name popped up.
>> No, I certainly think that the foundation has been a big turning point for the language. For someone that's coming come into the language a lot later than either of you, um, I've I've kind of I've not seen the rough road that PHP had in the early days. I came in around 7.2. Um, so I'm quite a late adopter. Well, I thought it was,
but it's getting better. It's getting better and and it's kind of kind of what this show is about is trying to uh highlight what where we're going with PHP and the fact that it is growing and it's getting better and better year on year. So um yeah, I've certainly seen with the foundation there has been a real change in the pace of this of how we're how the the language is uh developing. So uh we will add any uh
links into the description. I don't know if Chris found the the URL whilst we were we were talking there. Um but before we go any further, I think it's time for us to uh just have a little story from one of our partners. [Music] Let me tell you a quick story about our sponsor, honeybadger.io. One time, a customer of theirs had a background job run overnight that caused
hundreds of thousands of errors to be reported to Honeybadger by mistake. Like many other error tracking and performance monitoring tools, Honeybadger bills for monthly usage. And so this customer's mistake was going to cost them a lot of extra money that month. If you've ever used a monitoring service, you might have experienced something like this. Well, fortunately for this customer, they emailed Honeybadger support and received the most amazing reply. Honeybadger was resetting their monthly quota and cancelling their bill. This is just one
example of how much the small team at Honeybadger cares about their users. Ask anyone you know and you'll hear similar stories. Go check them out at honeybadger.io. It's free to get started and setup takes less than 5 minutes. Don't forget to bookmark it. That's www.honeybadger.io. Thank you, Honeybadger. >> Thanks, Honeybadger. >> Chris, where were you on Honeybadger?
>> I was watching it. >> You were just watching. I was >> Where's the thank you? Where's the appreciation? We've not rehearsed that bit. We need We need more practice there. Um so Oh, well. >> It's all right. It's your second episode. We We'll work on it. >> We We'll We'll get there. We'll get there. Um >> Okay. So, the main subject of this episode is the 8.5 release of PHP. And
that is Do we have a release date for that yet? Uh, that would have been a good question for me to think about, but it is on the wiki. And this is a good time to tell people where they can find out this information themselves. If you go to wiki.php.net, and I believe it's to-dosph85 without underscores, got it right off the bat. Um, that will tell you the release dates for all of the upcoming um, alphas, betas, RC's, etc.
um who's work who's actually doing being doing being doing being doing being doing being the release manager for that release. Um any votes related to well that's election votes but according to this GA is expected to be November 20th. Um and I know this process because by the way I've also been a release manager a couple of times in the past few years so I'm also active with that. >> Okay. So not not long now not long now till that one comes out. So >> that's two months. Yeah. Yeah. So,
shall we uh delve into what's what's coming new in 8.5? What have we got to look forward to? >> Should we start with my favorite one of them all? Let's have a look at clone with. >> Oh, clone with really. Okay. I mean, clone with sounds pretty cool. I'm not going to lie. I put it in my S tier. Um I I ranked all my features uh before before this podcast. Um yeah, clone with um obviously you can clone objects today
and that's awesome, >> but we have this sort of like new concept of like readonly properties, spinal properties, things that normally you would just set up in a constructor and never have to change any of these things. Um but that really doesn't mesh well with cloning because usually when you're cloning something, it's because you want to modify something about the new object. You want some new attributes to that object. Um, and even if you've got some factory method in your uh your root class, that factory method can't
just call clone and then modify because it's now working on a different instance and it's already finalized. So what clone with does is it gives you the ability to um specify what parameters you want to um what properties you want to change and what you want their new values to be during the course of the cloning. So it sort of temporarily unfalizes it and allows you to write to those properties really quick. So the the calling convention for that is just using clone as a function. First
parameter is the thing that you're cloning and then the second parameter is just a dictionary property name equals value property name value property and value. And then um for for pod castes for pod classes in particular um this is a pretty straightforward and easy way to to redefine a couple of properties in them. So as S tier feature I think >> yeah and I can see uses for that with frameworks all over the place. It gives
you the opportunity to have a single base that you clone and modify, but you're still keeping that restriction on >> Yeah. >> read only from that point onwards. >> Yeah. No. Um, should I continue on to others or or uh >> Yeah, let's go for it. I mean, >> the top of my S tier >> Yeah, the top of my S tier is the pipe operator. Um, and that's probably why Larry was on my mind earlier because this is another one that he championed.
um is um this was originally well originally within the PHP space introduced to HHVM. Um it is a it is a pipe and then a greater than symbol. Um the idea of this is you can take whatever's on the lefth hand side of that expression and pump it into the first argument of whatever is on the right hand side of that expression and then you can chain those. So it's kind of like object fluent calling where you have, you know, object arrow method arrow method arrow method. Um, but it's
at a functional programming sort of level. So you're just you're passing a value through a b bunch of different function calls. Pretty similar to that function composition thing that I mentioned earlier. Um, but more of a uh in this moment this is what we're doing sort of thing rather than a um give me a closure that will do this thing over and over again sort of thing. Uh so yeah, that one's coming. Um it is a little bit different than the way HGVM's implementation is. Um HGVM's
implementation is technically a combination of a pipe operator and something called a um GFA which stands for um oh my goodness, I'm losing my head on the expansion. These acronyms um partial function application. Thank you. is a partial function application. Uh so what you can do is you can in HHVM specify that um
the output of the lefth hand side goes into this magical variable just called dollar dollar um and you can fit that into the function call somewhere. So you can say something like uh uh implode open pairing a comma character and then dollar dollar. So whatever came from the lefth hand side is going to be dropped into the second argument in that case. Um so it's a little bit more versatile. Um I personally wanted that for PHP's version of it as well. But um people didn't want extra symbols and we
decided that implementing partial function application as a separate feature at some point in the future would melt very well with this. And so we can get the same effect just using um few separate features working together instead of uh one feature that tries to do two things at once. And I have to pay attention to my uh insulin pump because it's telling me my blood sugar is too high. Sorry. Um so yeah, pipe operator uh in my opinion a pretty cool function.
I used it a lot uh in writing a tool called FP ship it. Um, it was uh a tool that we used for taking all of our internal source code at Facebook and making it uh open source. So like remapping directories and doing stuff like that. So you'd have like a whole bunch of transformation steps that you would run through uh on every single commit that you're moving from internal material to external get. Um but I used it a few other places but uh
hopefully uh PHP devs will find it useful too. Um, and the last thing for S tier is the no discard attribute. So if you have a function that u maybe returns like you know a status of whether it worked or not, you probably want the caller to care about whether it worked or not. So no discard will require all callers to do something with the variable. Now they could just put it into uh do something with the value. They could just toss it into a variable
and forget about it. We don't try to guard against that but they have to at least like think about the fact that there's a return value and make a conscious decision not to look at it. So um this is a compile time enforcement thing. >> Um do we do we want to dig into any of those further or should I drop to a tier? >> So question on no discard then. Does that also include things that it throws? >> Um like exceptions. >> Yeah. >> I mean you you can't really discard an
exception. um you can fail to catch it and it'll propagate through the stack until it reaches the top and then become an error. Um oh I guess well technically you could discard an exception if you have it like in a catch and then do nothing with it. Um there's no way to guard against not doing something with an exception that you've caught. But in that case you're effectively doing the same thing as dropping a status result into a variable and then not doing anything with that variable. Right? I
mean, it's you're making a conscious decision to discard uh what you've gotten back rather than a uh an implied decision of just not doing the thing with return value. So that's that's kind of the difference there. >> And the use case I was thinking of was like for example, if an OM goes and fetches something from the database and it throws an error because the database isn't there. I've seen code on so many occasions where it's like, "Oh, but the database will always be there until the
day it isn't." And it's I' I've seen so many places where that's not handled. It's gone all the way through. And by having something that could enforce you caught that, that could give you serious strength. >> Well, the the question is where should you be catching it? Should you be catching it directly at the call site? Should you be catching it several frames up where you said build out this, you know, profile view? Should be you be catching it all the way at the top where
you say, "Well, your request just couldn't be handled." Um, without knowing where it should be caught um uh >> yeah, true. >> If we think of it from a it has to be caught somewhere, but we don't care like it could go all the way to the top, then how is that different from an exception being promoted to a fatal error, which is what we have now? True. >> What would you do if you didn't do that? >> I mean, for for me, I will always handle
always I will always handle exceptions at the point that they're being thrown. So if I've called a function that is in its own stack going to throw an exception, I expect to handle that at the point I've called that because I don't want it to go up the stack to an error handler most of the time. >> Well, so you'll do that. So like let's say you're saying like um go get user record number 12 from the
API. That's the call you're making and you're ready to catch the exception that comes from that. the implementation of that might be saying like, oh, okay, they're looking for record 12 from the API. All right, I'm going to call this function that builds the query out of it. Um, and then I'm going to pass that into the the function that actually uh sends the query off. And then that function calls, you know, focing
stack underneath that is what actually throws the exception. So should the query be handling that exception and then rethrowing it and then the thing that called the query handle that exception and rethrow it or should it just bubble all the way up to you because you're the one who has who knows how to deal with that exception. So >> yeah, >> we can't make a policy that just says the calling stack, the calling frame has to deal with it because that doesn't always work. >> Yeah, fair. It doesn't
because you could have you could have massively deep nested with a puncture >> call and they they could be completely appropriately deep. It doesn't have to be like a design problem. It can just be like that is what makes sense for this. So >> yeah. Yeah. And sometimes those stacks are 30 40 50 deep which >> Oh bless your heart only 50. >> I I was thinking of developers at the front end that deal with frameworks.
I mean, it's interesting that we've got those three. I think we may have just lost your sound, Sarah. >> All right. Can you hear me now? >> We can. >> We can hear you. Yes. Um, my headphone decided to just stop working. So, we're
going to put that away. And, um, my laptop uh, microphone is what defaulted in its place. Um, I wasn't even using that. I was using my my webcam microphone. Um, so I had to tell it. So, anyway, technical problems. Moving on. >> So, it's interesting. >> For me, it's interesting. We've got those three in your S tier and there's one in your A tier that I would have promoted.
>> So what what I said to you when I sent this to you was this is my personal take on it. Um I don't write PHP on a daily basis. So uh you know other people are going to cons consider stuff in my C tier to be S tier. So um that's that's why we have lots of people working on PHP. Um so let's move on to that. I have three items here too. I've got asymmetric visibility for static properties. So we've already got asymmetric visibility. You can say public and then private get on a
variable uh on a property rather. Uh now that also works if the property happens to be static. That's it. Pretty minor change but pretty important. Sometimes you want static properties that um um can only be set somewhere internal to the class but you still want to be able to see what they are. So um final property promotion. This goes with constructor uh property promotion. So you can say function construct uh public int dollar fu and then whatever
they pass for that first argument will just go into a public property called fu on the on the object and auto assign the thing. Um now you can make those final which you probably want to do for at least a few of them that are coming into your constructor like that. So that makes total sense. Uh and then the third one I've got is fatal error back traces. This is an INI setting. So there's underscores in between each of those words. And uh if you have that turned on and either there is an uncatchable error
um and because some of them are just pure fatal, like there's no recovering from them. Um or if it's like an exception that's bubbled all the way to the top and you never caught it, there's no exception handler, no error handler. um the default error output will have a complete back trace attached to it so that you can you know figure out how that happened. Um it's it's I think probably most usable for the uncut case more so than the um
the case where you have a default handler. Um, personally I would just define the handlers so that I could get the the uh sorry the but for the uncatchable ones is is me. I mean because those can't go through the handlers. Yeah. Sorry. Um I've been taking a lot of notes this morning. So So Chris, which one was the one that you thought was the uh the the one that deserved to be in S tier? >> Final property promotion. >> Final property promotion. Okay. All
right. Yeah. I mean, I really liked property promotion when it came in. I thought that was a really cool feature and final just makes sense to add to it. Um, I think it was just the fact that it was kind of a a natural evolution of the thing, like somebody forgot to include final. So, it's it's less, you know, um, uh, gamechanging and more just like, oh yeah, by the way, let's make sure this works. >> Yeah. Yeah. And it just meant that there's a few times where I was having
to not use property promotion because I'd got finals and >> so it'll be game changing for you. >> Yeah. >> Okay. Good. >> Um yeah, I mean that's a tier. Um we can move on to B tier. Um there's there's there's a lot of features in every new release of PHP these days. Thank you foundation for hiring people to work on this on a regular basis. Um, I think the biggest one is that, uh,
opcache is now just always built into PHP. Um, it has no dependencies. There's not a good reason why it shouldn't be built into PHP. Uh, when we first added it to the tree, which was in 5 something, I want to say 52, maybe 53. Um, we didn't have it building automatically because it was still kind of experimental at that point. But here we are in 8.5. We're pretty confident that opcache works and does what it says on the tin. So, let's just let's just
make it there. You you can no longer disa uh you can no longer disable it from builds. However, you can disable it at runtime. So, you can say I don't actually want to cache because um I hate the planet and I want to burn extra CPU cycles and watts and uh uh no, there's valid reasons to turn off the cache. Um but uh yeah, so I think that's pretty cool. and you always know it's going to be available. Um the override attribute um this is saying so if you have a um
let's particularly method uh in a child class that you're like this overrides something in the parent and I want to make sure that if the parents API changes I'm not going to be surprised by it. So I'm going to say like okay here is my uh do query method or whatever. Uh, and this definitely should be overwriting something in the parent. You throw the override attribute onto that method. And then at compile time, if the parent that you're inheriting from doesn't have a do
query method, it's going to raise an error and let you know. Um, C++ has this. It's literally just called override as a keyword. Um, or final is just override in in a final form. Um, and it means that the parent has to exist and actually specifically has to be defined as a virtual because not every function in C++ is overwritable, but that's not salient to PHP. Um,
uh, yeah, const expressions. So if you have an expression that exists somewhere um inside of a a context that according to the compiler must be condeed and this is not something that's really a user space aware thing but something like function fu takes parameter callable dollar x and the default value of that so we've got an equal there is um you know some callable function you know
we could do something like in quotes start to lower. That's the default function and in quotes it's going to work fine because a a string that contains the name of a function is still a callable. Um but we can't do like a first class callable where we say search to lower open parents dot dot close pars because that is too dynamic of a function. Um well not anymore. Now that can exist in um static consty expressions as well um as well as regular closures. So you can do you know function without a name x
braces things like that to to return values. So mostly this means you can have default callbacks for your function decorations. You don't have to do something like nullable callable equals null and then check if it's null then we set it to something else. Um which is probably what people are doing today. Uh so those are going to work in A5. Um you can also now put attributes uh onto constants. um you know we can have them on functions and parameters and classes
and everywhere else. Now they can exist on global constants and class constants as well. So it's just it's one more place for attributes to exist. Um the array first and array last functions I was surprised to learn these don't exist yet. Um, you know, you can have you can for each through an array. You can get array key at some index, but there's nothing to just say what is the first value in this array or what is the last value in this array, which seem like pretty common tasks. And in fact,
we have the functions array key first and array key last, but not for values. So, we have those now. >> Yeah. So that must be something that Laravel have implemented because I'm sure I've used a first on arrays. It must be framework implementation. >> I mean it could be what it's doing is it's getting the first key and then using that to be reference the array to get the value. >> So you know one less step. Yay. Um and
I'm just surprised we didn't have that. >> Yeah, I'm the same. It must be a helper in Laravel then if because I think I'd use something similar. because it's not a hard thing to do. Like even before the array key first and array key last functions existed, you could do something like reset array uh and then get an each out of it to get the value or or you know last array or or rewind array or whatever. Um these are old PHP3 functions. They've existed for a long time. So you always could do
it. Um it's just how much pain it is kind of depends on what version you're on. Uh, sorry. Um, but yeah, going back. Um, this is kind of a minor thing. I put it in the B tier just because it's it potentially might surprise somebody. Um, the directory class. Um, I don't even know how many people use this. It's not something I ever use. Um, but it is sort of in a a category of things that used to really
only exist from functional calls, but now there's a concrete definition for it. um you're supposed to create a directory using the dur function and it'll return an instance of the directory class. Um but technically you could do that directly and it's going to give you a class that doesn't really have a consistent internal structure to it. Uh which is probably a bad thing. So now you just can't directly instantiate it. So if you've been trying to do that, sorry, but why are you trying to do that? I don't understand. Uh chips.
Everybody likes chips. little dip. Um, cookies having independent and partitioned state. I had to write that one down. Um, I'm not going to try to explain what this means because I don't know what a partitioned cookie is, but if you like partitioning cookies, you can do that now. Um, it basically just means adding partitioned true to the set of options on set cookie or set rock cookie. And apparently it has to come with secure equals true as well. So I encourage you
to find the RF the uh the the RFC for that standard uh if you want to know more about that. Uh and then the last thing we've got for Btier configure URI parser for filter validate URL. There were a bunch of improvements to the filter extension made in 8.4. Uh this was on the RFC from 8.4. It just never got actually implemented. Oops. Uh it's implemented now. So have fun. Um,
>> that one is one that is seriously useful in web applications. The number of times people will throw things. >> Yeah, you can throw things into a text box and people will just accept it and go, "Ah, it's fine. It's a URL text box. We told them it was a URL." >> Yeah. >> Well, so the the input the the input filtering extension has been able to do this all along. So you'll say like uh filter getvar fu and apply URL filtering on it like that that's existed since 5 something.
Um this is for the URI parser um which is using a lot of the same bits and pieces of it. Uh it but it's it's a separate piece. So if you wind up um let's say accepting a URL as a parameter it parses as a URL fine but then one of the arguments in that URL uh is has to be a URL itself because your dog you like URLs um that's where URI parsing comes in.
Um, yeah. All right, then. Cat tier. Um, graphim aware Levenstein distance. You ever used Levvenstein functions in PHP? Did you know there's a Levenstein function in PHP? Uh, tells you how similar two words are uh in just in their spelling. That's it. Um, so like um color versus color, it would tell you 11 shine distance of one because we spell it differently. Um
now that is graphim aware. So if you have uh compositions of components of letters uh or idioraphs rather um that end up being the same thing. It's like you might in unic code have you know Latin lowercase e and a combining acute diuretic that is the same thing as the single character E with combining acute diuret diuretic. Diitic a diuretic is a different thing. Sorry kids. Um so it will tell you now
that those two e with an accents on them are the same letter in fact. So uh but that is a new function. So that is now graphim levenstein because it exists within the intel extension and graphim is one of intel's prefixes. Uh we've also got get error handler and get exception handler. These will just return you the callables that would be invoked if an uncaught error or uncaught exception were to happen. I don't know what the use cases for that is personally, but I'm sure somebody does.
Maybe they want to mock errors during testing. Uh maybe they just want to know that one has been set. So there you go. Have fun with that, I guess. Um delayed target validation. This is an attribute. So you know hash square bracket delayed attribute uh delayed target validation rather. Um this is kind of an affectation that we came up with for stuff like the override attribute um and other things that have been introduced since 8.0. Um like
attributes that exist only in newer versions but not older ones but we want our code to still work correctly. we can say delay delay the validation of this target until runtime rather than a compile time. So we have a chance to load in our polyfills and make sure that we have something defining that attribute. Um I'm not sure why we don't have that enabled all the time except for just um efficiency sake because a compile time one only has to be done once but a
runtime one has to potentially be done every time it's run. But this is this is just meant to make it easier to have a path uh for forward compatibility. So you can introduce stuff into the engine in 8.5 or 8.6 and still be able to write it into your code. It's run going to run on 8.1 or 8.2 or 5.1 if you're still running 5.1. Don't be running 5.1 or I'll come for you. Um so filter throw on failure is an extra
flag that you can pass to the input filtering functions. um just means throw an exception instead of returning all. That one seems pretty smart to me. I don't know why I put in Ctier. That's actually kind of A tier. Um possibly S tier. Uh because exceptions are the way. Uh and then >> Oh, sorry. >> Do you know what it's throwing? >> Do I Do I know what it throws? >> Yeah, >> I believe it throws a value exception, but I would have to double check that. Value exception makes the most sense to me, but I could be wrong.
>> Just kind of makes sense. Yeah. Um, well, good news. You can go to wiki.php.rfc and you can find all of the RFC's that have been written for every version of PHP since 5 something. Uh, and you can read uh what it what it throws, why it throws it, and uh depending on the RFC author, who complained about the fact that it throws that instead of something else. So, uh you can we're entirely open. Have fun with that. Uh so the last thing I have on my list
is persistent curl share handles. Um share handles are basically where you put stuff like your cookie jar for uh multiple requests. Uh those can now exist persistently between connections and we are um we made a decision kind of in the process where we're going to decide what that persistency handle is for you unless you really want to override it. Um, I'm not sure what the overall value is in um, persistent share handles. I
guess maybe you might want to have like it might be expensive to do an authentication and that authentication sticks into a cookie somewhere and you don't have to reauthenticate your API, but I don't know. If you need persistent share handles in curl, good news. Here you go. They're around. Uh and then everything else is is uh the the the D tier which is stands for deprecation. Um it doesn't actually mean these are not important but they they are the usual every minor version we have a
deprecation list. Uh Nikki sort of uh created this tradition. It's a great tradition. It gets PHP to clean up after itself. Um we can go through the list as well. Um I there is a deprecation RFC listed from the wiki. The thing is that RFC mostly covers 8.4 deprecations um for reasons that I'm I'm not entirely sure. So I actually had to go to the uh news file in the source tree. By the
way, the PHP source tree has a news file all caps right at the base of the URL. Um, and that will tell you every single change, whether it was a new feature or a deprecation or a fix or whatever, all that stuff that goes in the change log. You can read that at any time. Um, so starting at the top from I think was my most important. Um, redecoration constants is now deprecated. Um, I don't know who doesn't know this, but the define function allows you to change a
constants value for global constants, which seems insane to me, but um, WordPress depends on it. Uh, or at least did for a while. Um, we pointed that out to them uh, when I was working on HHVM. Actually, I was testing WordPress with HHVM. Found out it didn't work um, for among other reasons, the fact that it wanted to redefine constants. Uh, so I first had to implement constant redefinition in HBM and then tell them, hey, by the way, do you have to do this? Is it really important? And they're
like, no, it's actually not that important that we do that. So they may not require it anymore. Um, might be something to check out on. This was a long time ago. 13 years, 15, something like that. I'm old. Um, >> I'm I'm amazed that was even allowed. um redefining constants. Yeah, >> the whole point of a constant is that it's constant. >> It's a bit unhinged, isn't it? Yeah. Um
so we're deprecating that. Um it's expected to be an error in PHP9 is is the currently agreed timeline. Um if if this you know breaks your spacebar heating workflow, then you know love to hear from you. Uh, incrementing non- numeric strings. I'm sad to see this one go because this is one of the walls that I always like going to. It's something we inherited from Pearl. Uh, if you have a text string, let's say it's ABC lowercase,
and you do a post increment on that, >> what do you think that does, >> Chris? I'm doing a >> I actually can't remember what it did, but didn't it didn't it actually give you the next letter in most cases? >> Yep. Uh from a right to left standpoint, you would have ABD. And if you got all the way up to Z or zed if you prefer, um it'll give you uh ACA because the the
you know, carry the Z to the 26's place. And yeah, um it's something that Pearl did, so PHP did it, too. Uh there was no matching decrement ever. Um you can decrement a string, it'll do nothing. Uh so we're finally actually deprecating that in PHP because it's kind of a it it's it's kind of a surprising feature that you don't expect, especially given that it's non-ymmetric.
Um, I probably have a few scripts that actually depend on that because for whatever reason I actually do need that behavior. Um, but I'll deal with it. It's fine. Um, I didn't actually vote on that one. Uh, I just sort of harumped at it. Um, another one that I think um might catch people by surprise is the http\_response header local variable. So, if you f open an HTTP or HPS URL using PHP stream
wrappers, uh it will take all of the headers that the um remote sent back and it'll just shove them into a magical array that appears out of nowhere as an HTTP response header variable or headers. I can't remember if that was cap that was pluralized or not. Um, and for me, this was always useful for when the request failed, you know, 404 or 403 or whatever, you can find out why it failed, um, and how it failed and and
record that. We have ways to get at that information that don't require magic variables anymore. Uh, so we're trying to encourage people to use those. We've had those new ways for a while. Um, and making variables magically appear is not great for jitting. So, we're just trying to kind of get that out of the way. Um, along with everything else. Uh, oh, and the back tick operator. You ever use the backtick tick operator in or I guess it's a quote technically. Um, so, so I'll pick on Mike this time. Mike, what
does the back tick do in PHP scripts? >> I don't know because I've never used it. >> Okay, good. Chris, do you >> I've used it, but it was like five years ago. Well, and this is one of the reasons we're deprecating it because people don't tend to know it exists and maybe don't even know how to look up how what what it does. Although, I'm pretty sure you can type php.net/backtick and find out. Um, maybe test that. Um, >> you can do if you know it's called a backtick.
>> Oh. Uh, yeah. Uh, the backtick, that's the number on a US keyboard that's right underneath the ty at the top left corner of the keyboard. Uh, if anyone is uncertain. Um so yeah the backtick operator works the same way it does in bash actually. It just says execute this string on the command line. Um it supports the same interpolation as double quoted strings. So you can put variables into there. Um it is essentially a alias for the shell exec function. Um and by essentially I mean
literally when you compile it sees back tick and it says call the shell exec function. Like it doesn't even retain knowledge that it used to be back tick. So if you're using back ticks anywhere, just replace with a call to child exec. It'll have zero impact on performance. It'll improve readability. Uh just you don't need back ticks. Um oh, and then this one, this one I didn't know existed. I'm always excited when I find one that I didn't even know existed because there's lots of stuff in
PHP that surprises me, but I don't get to them often. Um, >> this one feels like a syntax error. >> It does, doesn't it? And sorry Chris reading ahead because he has my list. Um terminating case values with a semicolon. So you already know you can in a switch statement you have like uh switch dollar fu uh case one two three case u you know some constant case this and you always end those with colons right case 1 2 3 colon. That's how you
define a case right? You could also use a semicolon if you want. We don't need a whole colon. That's wasting half a colon, right? Um, yeah, I had no idea this worked. I immediately jumped to 3v4l.org to verify that it works and it does and that surprised the hell out of me. So, we are getting rid of that alternative syntax. Um, because don't write your code that way, please. >> How many PHP stand errors do you think
people are going to get with this one from typos? Well, that's a good question because I like I don't know if PHP send covers this or or you know any other you know code linting tool because I I what I imagine is the first time they encounter it, somebody reports a bug and it says the semicolon is perfectly valid here. I want to use it like spacebar heating works for me. Just give it to me. And the the maintainers are like well if
it's in the grammar I guess I'm going to support it. So no errors is my guess. >> So at the moment they're going to get no errors because it's valid code. >> You're deprecating that. So what's going to happen next? You're going to end up with people who've mistyped it not knowing they've mistyped it that have had it on production for 10 years. Like how does this work? I don't understand. I've got a feeling PHP Storm starts
shouting at you if you use a semi semicolon because I think I've done I think I done it when I myself when I was learning about switch statements I think I did it by mistake sort of because you're so used to hit semicolon at the end of everything >> because semicolons go at the end of lines obviously. Yeah. So, I I'm pretty sure I've done that and it's come up and said, "No, it's a a it's a colon, not a semicolon." And I've changed it if I
remember rightly. >> Entirely possible. >> I don't tell Roman I've never actually used PHP uh Storm, but I I like Vim. Sorry. Um yeah. Anyway, um the rest of these start to get boring. Um that was the last of the fun ones, but I was really looking forward to that one. Uh array object and iterate array
iterator with objects. Um honestly, that sounded so boring I didn't even look up what it was. Um but I imagine it's something to do with passing an object uh into the constructor and then iterating the properties in them probably. um put an array cast if that's the case. >> The the same thing as what collections did in the first place when Laravel first implemented them. Collections were a class but they were also array iterator.
>> Mhm. >> So you could just treat them as an array. >> Well that's what array object does actually is it is it um it gives you something that behaves like an object uh or an array. Um, that's its general purpose, but like how you populate what goes into that I think is what's changing. But read the RFC. See, I'm I'm giving you homework class. Your homework for today is to go to wiki.php.net/rfc and figure out how this works because Sarah couldn't be bothered to do the
research for this episode. Uh, yeah. So, passing uh values passed to the CHR function. CHR takes a takes a bite, right? It takes a value between 0 and 255 obviously to produce one one ASKY character because ASKI is good enough for anybody, right? Um I have to I have to exert my American imperialism before I move. By the way, I'm moving to Portugal in a couple of weeks. Um so I'm going to have to figure out how to deal with other characters
heads. Um anyway um currently or in older versions CHR will take bigger values and I think what it'll do it is that will uh quietly modulo that 256 and just take the bottom eight bits and tell you that's what that character would be. Uh which is a little unhinged. Um so now it's going to actually give you an error or an exception or something like that if you I >> can't see that causing problems in programs. >> No, that would never cause a problem.
it. That's That's insane. Um uh speaking of we have non-cononical cast names. So you can do something like uh parentheses around int or float or bool and that'll cast to those types. Right? Did you know you can put parentheses around the full word boolean and integer and um double uh no is it double? Yeah, I think it's double double instead of float. Um there's a bunch of other cast types that you can do and
it'll still cast it to that type. Um this unfortunately ends up reserving a whole bunch of words out of the grammar for PHP. So nobody can like define an integer class for example because of this or well they couldn't until we had contextsensitive parsing. But, um, this is just cleaning up stuff that there's too many ways to do some things and it's okay to get rid of some of the ways to do some of these things. >> Um, did either of you know there used to be an unset cast? So, open parent,
unset, close parent. >> It only does something meaningful if you do it on a dollar variable. But if you say unset cast a dollar a dollar variable, it will turn that variable's value into null, which is not quite the same as unsetting it, but you know, uh, we got rid of that several versions ago because it didn't make a lot of sense. And >> but why would you ever do that? It would be quicker to do variable equals null.
>> Ask Rasmus, make him explain himself. And in the final edit, you can just put a little picture of Rasmus looking sad up here. I have that picture if you want it. Um, so yeah, uh, the exclude disabled parameter for the get defined functions, uh, function call deprecated. Um, I don't know why you would deprecate that. Sometimes, wouldn't you want disable? Well, who knows? Uh, returning null from a
debug info imple implementation. Uh, on a class, you can find an underscore\_debug info uh, function. uh if you return null from that I think it does the default behavior instead of whatever you return um but you can always just cast the array to the object to an array so it's the same difference um implementations of RFC 7231 date formats um there's a global constant and a datetime interface constant for that now um Intel error
level uh INI setting oh sorry there is not that format anymore I should have backwards. Um, the Intel error level INA setting is now gone. Um, you can set that as a global anymore. And I think the main re motivation there is that it didn't always work the way you thought it did. And so it was kind of false advertising. Um, the URI DSN for PDO is gone because well is deprecated because uh it's basically a security hole
waiting to happen and PHP gives users enough footguns as it is. So let's maybe hide that particular foot gun. And then we just got a bunch of um function deprecations. Uh f info close uh the context parameter f info buffer image destroy socket set timeout xml parserfree and all of the set accessible methods on the reflection classes. Most of those because they don't do the things you think they're going to do anymore. some because of this uh process
we have where we're changing uh the resource type to be objects that still behave the same way because we're getting rid of the resource type eventually. Maybe nine, maybe 10. Uh PHP 10, who knows? Um and then set accessible just straight up doesn't work anymore. We've changed accessibility so much that you can't it doesn't make sense any longer to just say make that property public. It's fine. Just just trust me, it's public now. um we just
are not supporting that anymore. So that's it. That's that's deprecation tier or Dtier. Um there are no F tiers because PHP itself is S tier which automatically erases all F tiers. Um and uh yeah, PHP 8.5. Let's go. It's >> looking like it's going to be a very good release. There's a lot >> Oh, they're all good releases. Um, Matt, Mike, you you you were you were talking about uh not having a lot of insight into, you know, the the the old days and
I kind of took this implied the bad old days. Um, I think it's really tempting to look back 5 10 years in anything and say like, oh, it was terrible then, it's so much better now. But the thing is at the time, you know, PHP 5.6, we weren't thinking, oh, this is terrible. We were thinking like, man, this is the best PHP has ever been. This is freaking awesome. this is so much better than the battle in PHP4 days. And when PHP4 was out, we weren't thinking it was terrible. We think, oh, this is so awesome. It's so much better than the battle in PHP3 days. So, like it's,
you know, be context aware. You know, PHP is awesome. It's going to get more awesome. Someday we'll look back on 8.5 and think, "God, what were you thinking? This was a terrible release. So embarrassing." But, uh, it's not. It's It's >> PS. Yeah, I I've heard the stories and I suppose some of what we're we're trying to do especially with this show is maybe hopefully turn those people around that looked at PHP and has a bit of a bad
taste in the mouth from earlier days. Uh I as I say I was lucky enough to come in where it was it seemed so logical easy it is easy to learn um which I I I found very helpful um and it's it is used in the majority of the internet and we are trying to we're trying to explain to people in a more positive way that PHP is still here and it is growing and it's improving. So yes, every every time
every release and at the moment we're having yearly releases. So every year we are growing on the previous year. So yeah, it's it's brilliant and uh thank you very much for that really detailed uh talk uh through what's coming, what what we can expect in in November. Um so really looking forward to some of that. Um so just just to move on from from there apart from what you've already talked about in in the um the upcoming
release what would you say are the really sort of exciting things that are happening in the PHP world community and the language for you at the moment? >> Well for me personally it's mostly foundation business honestly. Uh, like I said, we do have a couple of projects coming up that are going to be announced. They're not there yet. Um, I'm I'm still trying to get us into a point uh where we can reliably have
public versions of our minutes to just put into GitHub. Um, and we do we do we do publish versions of them. Um, I want to get them a little more public. I ideally I'd like our our Zoom meetings to just be live streams. Um, but there are there are complications with that. Um, sometimes we talk about stuff that is um it it for the necessity of protecting confidentiality of of of people.
Sometimes that just can't be public. You know, there's there there's a lot of valid reasons to have closed doors sometimes, but I'd like those doors to be as open as possible. Um, so that's that's something that I'm still working on. Sorry, I've been trying to work on it a little harder. Um, And now I'm trying to think what I can actually talk about that that we have coming up unfortunately. Um there's one thing that'll be announced pretty soon. Um very soon. Um
it doesn't make sense for me to think about it because I for published on GitHub already then I probably shouldn't be talking about it. So you can check out github.com uh I think our organ name is the phpf but um we'll get that in the show notes. >> Yep. We'll go ahead and try those. >> Um, >> yeah. And, uh, and and we'll see what comes next. Um, one thing about the foundation I did want to mention that I didn't throw in at the beginning that I usually try to add um, and and just to
be absolutely, you know, upfront and clear about it. Um, the foundation does not actually dictate what PHP is going to do. PHP is still a completely independent sort of open source project. Um, things get voted on. Um, and I can tell you that the PHP project uh is working on some changes to our voting system to make them um a little bit more transparent about why people are making votes. Um, have we're there's a RC in in
voting right now to add an abstension vote to to every vote. So, you know, somebody's at least looked at it and said, "I choose not to have an opinion rather than ignored it." Um, and uh, we'd like to get, you know, like I said, reason for vote as a field that you can add in so that we can understand maybe why something didn't pass, uh, or or why it did pass regardless of concerns. Um, uh, but yeah, so the the project itself is still completely independent. It depends on votes. It depends on the
people who are actually building it dayto-day um, or have legacy voting karma um, for reasons. Um but the foundation does exist to um like I said fund the developers who are working on it many of whom have votes anyway um because they earned them the oldfashioned way uh to sort of like combine feedback from frameworks um so that framework interoperability group that's what I couldn't remember earlier the ones who make the PSRs sorry um to
combine opinions from frameworks uh to direct you know not you know dictate but to at least help direct where PHP is going to go next. Um and uh uh you know just act as a a gentle guiding force rather than um you know somebody who's who's got their hands on on the reins directly because that that is still a project and and shall always be if I have anything to say about it. Um oh that's another one that's interesting. Ben Ramsey uh I think he actually
already passed it. um he went to every single official license holder because there is a formal organization called the PHP group um that's made up of a bunch of people who were involved in the project in the in the 90s uh who just kind of became the official owners of PHP and he tracked every single one of them down most of whom haven't been involved in PHP in a while and he got authorization from every single one of them that we're actually able now to update the PHP license um to be something that is a little bit more adaptive to the fact that people come in
and go out of the project over time and you know uh we don't have to worry about weird license issues you know if somebody passes on I'm 50 already you know I I've got some years left but I don't have that many years left um you know we have things for for the good project so >> Ben was on the other podcast a couple of weeks ago maybe three weeks ago talking about that RFC and the value behind it >> and the fact that it isn't just you know
finicky little change on a contract. It makes a big difference for some people. >> Um yeah, it it makes a difference. Uh particularly if you're dealing with companies who want to be like, uh we knew we want to know what we're working with. We want to know where this is coming from. Um we actually got a a request on some um we got a CISA request, CISA, um the government wants to know where how you're doing your secure development and and your your processing. Um and I ended up having to respond to that. Well, I say the government, the US government. There are
other governments. Um, but I ended up uh responding to that one uh to be like, "Yeah, no, no, it's cool, dude. Open source projects are exempt from this. Read your own contract." Um, but you know, we we still have to these are still things that like at the project level we have to think about. You know, we it's not just writing code that runs code. It's a bunch of boring stuff that comes with it.
It's you call it boring stuff. It's the stuff that keeps the language alive. >> It it is stuff that keeps the language. Well, I mean, as an engineer, it's kind of boring, but but it is essential. Yeah. >> Cool. Well, well, thank you very much for all that. Um, now you're quite often in our Discord channel, and I'm going to see if I can put it on the screen and see if that works. Yes. Sorry, I was making that whilst we were talking. Um, so if anyone listening can
reach out to you, you're quite happy to to uh answer questions in there. Um, you're in there quite a lot and there's a lot of other amazing people in our Discord. So, if you're not in the Discord, why not? You should be there. Get over into >> every name I dropped in this uh is in there. Even Miller might not be in that one. I know he's in the PHPC Discord, uh, which I should probably know the invite URL for, but I don't.
>> If you ask there, I'll get get it to you. >> Yeah, >> we probably put in the show notes. >> We can put that in the show notes. We're going to have to watch the whole thing to remember what we've now promised to put in the show notes because I've not been making notes of what we're putting in the show notes. But yeah, no, >> you mean you haven't been sitting there with a pen. >> I mean, good news, there's a recording of it. So, >> yeah, that >> I mean, this is helpful. Yeah, I have been sitting with a pen, but I've not been doing anything with it. I've just been twiddling in my fingers out of shot. So, um yeah, no, thank you. Thank you
very much. That's been very helpful. Um very insightful and I'm hoping that uh that we keep moving forward and progressing um in that way. Uh my I'm afraid my dog is now at my heels trying to ask for her dinner. Um so we and we're running a bit long, so I think we'll we'll say goodbye there. and we will see you all in two weeks time. Thank you very much. >> Thank you for inviting me on and good luck with the new show. >> Thank you. Bye., 2:PHP Alive and Kicking With Sara Golemon, YouTube, 01k9fygw880ctk78x3eda15xta.