#phptrick search results

When using #PHP isset(), the language construct hides errors because, ... well... that's what is being tested there. Unless there is an object, where an array is expected. Then, it leads to a fatal error. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. When using #PHP isset(), the language construct hides errors because, ... well... that's what is being tested there.

Unless there is an object, where an array is expected. Then, it leads to a fatal error.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

A few days ago, I warned about isset() and a possible #PHP Fatal error. Given that isset() and ?? share the same code, it is not suprising that ?? hold the same trap. That bug should go away, the sooner the beter. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. A few days ago, I warned about isset() and a possible #PHP Fatal error.

Given that isset() and ?? share the same code, it is not suprising that ?? hold the same trap.

That bug should go away, the sooner the beter.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

It is not possible to cast any #PHP enum cases to (string) or (int) even when... they are backed! That looks like a natural feature, though. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. It is not possible to cast any #PHP enum cases to (string) or (int) even when... they are backed! 

That looks like a natural feature, though.

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

There are, at least, 4 ways to create a closure in #PHP. They all will be callable later. On the other hand, they behave differently to check the underlying method. All is in the timing. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. There are, at least, 4 ways to create a closure in #PHP. They all will be callable later.

On the other hand, they behave differently to check the underlying method.

All is in the timing.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

Dynamic class constants is achieved with #PHP 8.3 class constant syntax, and the constant() function. It also applies to enumeration cases. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. Dynamic class constants is achieved with #PHP 8.3 class constant syntax, and the constant() function.

It also applies to enumeration cases. 

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

#PHP question of the day : when you know that 2*2 = 4 2^2 = 4 (too) 2.5^2.5 = 9.8821176880262.. Where is this 6 coming from ? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. #PHP question of the day : when you know that 
  2*2 = 4
  2^2 = 4 (too) 
  2.5^2.5 = 9.8821176880262..
Where is this 6 coming from ?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

It is easy to create a map from a list of object, using #PHP array_column() and the second argument null. That null represents the whole object, and the third argument is the indexing key. array_column($list_of_objects, null, 'id'); #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. It is easy to create a map from a list of object, using #PHP array_column() and the second argument null.

That null represents the whole object, and the third argument is the indexing key.

array_column($list_of_objects, null, 'id');

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP has a 'precision' directive that controls the number of decimals displayed by float values. It default to 14, and peaks at 18, and gives up at 54. Use gmp for large numbers. When changing it, don't forget to reset it to default. php-tips.readthedocs.io/en/latest/tips… #phptip #phptrick

faguo's tweet image. #PHP has a 'precision' directive that controls the number of decimals displayed by float values.

It default to 14, and peaks at 18, and gives up at 54. Use gmp for large numbers.

When changing it, don't forget to reset it to default.

php-tips.readthedocs.io/en/latest/tips…

#phptip #phptrick

And since PHP 8.0, it is also possible to use the keys as named parameters. It solves the problem to put the arguments at the right place. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. And since PHP 8.0, it is also possible to use the keys as named parameters. It solves the problem to put the arguments at the right place. 

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

#PHP doesn't allow the dynamic creation of class constants (nor methods, nor properties). So, don't try the code below : I did, it doesn't work. Now, how would you make a dynamic class constant, in spite of these limitation? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. #PHP doesn't allow the dynamic creation of class constants (nor methods, nor properties). So, don't try the code below : I did, it doesn't work. 

Now, how would you make a dynamic class constant, in spite of these limitation? 

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

#PHP allows to use 'class' as a class name in a type. Same for interface, enum... and some others. Hey! I'm also not too proud of myself, but it made me chuckle. php-tips.readthedocs.io/en/latest/tips… #phptip #phptrick

faguo's tweet image. #PHP allows to use 'class' as a class name in a type. Same for interface, enum... and some others.

Hey! I'm also not too proud of myself, but it made me chuckle.

php-tips.readthedocs.io/en/latest/tips…

#phptip #phptrick

Since #PHP 8.4, we can have properties in interfaces! Thank you, property hooks! #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. Since #PHP 8.4, we can have properties in interfaces!

Thank you, property hooks!

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

Indeed, the date() function doesn't support the u and v format characters, that provide milli and micro seconds. That might be a reason to move to new DateTime() and DateTimeImmutable(). #phptip #phptrick 3v4l.org/eFSme

faguo's tweet image. Indeed, the date() function doesn't support the u and v format characters, that provide milli and micro seconds. 

That might be a reason to move to new DateTime() and DateTimeImmutable().

#phptip #phptrick 

3v4l.org/eFSme

When using a referenced argument, the type is checked but it is not garanteed. After execution, it might be different than initialy. Rare, but surprising. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. When using a referenced argument, the type is checked but it is not garanteed. After execution, it might be different than initialy.

Rare, but surprising.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP can type arguments, properties and returns. But can it type also local variables ? Well, it could, and for a long time. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. #PHP can type arguments, properties and returns. But can it type also local variables ?

Well, it could, and for a long time.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP mixed type accepts any type, just like no type. But it is also making property unreadable before initialisation. And that's often a useful check. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. #PHP mixed type accepts any type, just like no type. But it is also making property unreadable before initialisation.

And that's often a useful check.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

TIL that #PHP reports duplicate constant definitions in different interfaces. This is very unusual occurrence. So, shall we always give unique names across interfaces? Just avoid multiple interfaces with constants on the same class? #phptip #phptrick php-errors.readthedocs.io/en/latest/mess…

faguo's tweet image. TIL that #PHP reports duplicate constant definitions in different interfaces. This is very unusual occurrence.

So, shall we always give unique names across interfaces? Just avoid multiple interfaces with constants on the same class? 

#phptip #phptrick 

php-errors.readthedocs.io/en/latest/mess…

A #PHP variadic argument collects all the unused named parameters, along with their key. That way, it is possible to handle them with their name inside the method. On the other hand, array_merge (and some cousins) refuse them, and emits a Fatal error. #phptip #phptrick

faguo's tweet image. A #PHP variadic argument collects all the unused named parameters, along with their key.  That way, it is possible to handle them with their name inside the method. 

On the other hand, array_merge (and some cousins) refuse them, and emits a Fatal error. 

#phptip #phptrick

It is Friday, so why not cram as many #PHP operators in one single operation, and make it work? Look at this beauty! Could you make it run? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. It is Friday, so why not cram as many #PHP operators in one single operation, and make it work?  

Look at this beauty! Could you make it run?   

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

It is easy to create a map from a list of object, using #PHP array_column() and the second argument null. That null represents the whole object, and the third argument is the indexing key. array_column($list_of_objects, null, 'id'); #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. It is easy to create a map from a list of object, using #PHP array_column() and the second argument null.

That null represents the whole object, and the third argument is the indexing key.

array_column($list_of_objects, null, 'id');

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

It is not possible to cast any #PHP enum cases to (string) or (int) even when... they are backed! That looks like a natural feature, though. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. It is not possible to cast any #PHP enum cases to (string) or (int) even when... they are backed! 

That looks like a natural feature, though.

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

Dynamic class constants is achieved with #PHP 8.3 class constant syntax, and the constant() function. It also applies to enumeration cases. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. Dynamic class constants is achieved with #PHP 8.3 class constant syntax, and the constant() function.

It also applies to enumeration cases. 

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

There are, at least, 4 ways to create a closure in #PHP. They all will be callable later. On the other hand, they behave differently to check the underlying method. All is in the timing. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. There are, at least, 4 ways to create a closure in #PHP. They all will be callable later.

On the other hand, they behave differently to check the underlying method.

All is in the timing.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

A few days ago, I warned about isset() and a possible #PHP Fatal error. Given that isset() and ?? share the same code, it is not suprising that ?? hold the same trap. That bug should go away, the sooner the beter. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. A few days ago, I warned about isset() and a possible #PHP Fatal error.

Given that isset() and ?? share the same code, it is not suprising that ?? hold the same trap.

That bug should go away, the sooner the beter.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

When using #PHP isset(), the language construct hides errors because, ... well... that's what is being tested there. Unless there is an object, where an array is expected. Then, it leads to a fatal error. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. When using #PHP isset(), the language construct hides errors because, ... well... that's what is being tested there.

Unless there is an object, where an array is expected. Then, it leads to a fatal error.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

It is Friday, so why not cram as many #PHP operators in one single operation, and make it work? Look at this beauty! Could you make it run? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. It is Friday, so why not cram as many #PHP operators in one single operation, and make it work?  

Look at this beauty! Could you make it run?   

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

So, take a #PHP array, but some value in it (like, anything). Can you make an infinite loop out of this? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. So, take a #PHP array, but some value in it (like, anything). 

Can you make an infinite loop out of this? 

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP mixed type accepts any type, just like no type. But it is also making property unreadable before initialisation. And that's often a useful check. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. #PHP mixed type accepts any type, just like no type. But it is also making property unreadable before initialisation.

And that's often a useful check.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

In #PHP array_merge_recursive(), what is recursive? Does it go deep in the guts of the arrays, or does it merges values that look alike? Or something else? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. In #PHP array_merge_recursive(), what is recursive?

Does it go deep in the guts of the arrays, or does it merges values that look alike?

Or something else?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

Since #PHP 8.4, we can have properties in interfaces! Thank you, property hooks! #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. Since #PHP 8.4, we can have properties in interfaces!

Thank you, property hooks!

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

The humble bitwise operators (& ^ | ) have a hidden secret : they work on integers and also on strings. But not on both at the same time. One of the earliest #PHP feature, still available 30 years later. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. The humble bitwise operators (& ^ | ) have a hidden secret : they work on integers and also on strings.
But not on both at the same time.
One of the earliest #PHP feature, still available 30 years later.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP methods must be compatible with the one in the parent. Except __construct, which may be different. And except abstract __construct. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. #PHP methods must be compatible with the one in the parent.

Except __construct, which may be different.

And except abstract __construct.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP recursive methods are easy, because they have a name. What about closures? arrow functions? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. #PHP recursive methods are easy, because they have a name. 

What about closures? arrow functions? 

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP can type arguments, properties and returns. But can it type also local variables ? Well, it could, and for a long time. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. #PHP can type arguments, properties and returns. But can it type also local variables ?

Well, it could, and for a long time.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

When using a referenced argument, the type is checked but it is not garanteed. After execution, it might be different than initialy. Rare, but surprising. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. When using a referenced argument, the type is checked but it is not garanteed. After execution, it might be different than initialy.

Rare, but surprising.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

<=> #PHP spaceship operator may be conveniently chained together to make a multisort() tool. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. &amp;lt;=&amp;gt; #PHP spaceship operator may be conveniently chained together to make a multisort() tool.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

Just discovered that PHP's array_chunk() is like Naruto's Shadow Clone Jutsu - it splits a big array into smaller, manageable pieces. Perfect for when you need to process data in batches without overwhelming your server's memory 🍥 #PHP #Naruto #Development

MicasoMarbach's tweet image. Just discovered that PHP&apos;s array_chunk() is like Naruto&apos;s Shadow Clone Jutsu - it splits a big array into smaller, manageable pieces. Perfect for when you need to process data in batches without overwhelming your server&apos;s memory 🍥

#PHP #Naruto #Development


Sometimes, you'll find underscores in your HTTP variables, where you expected other characters, like +, . or space. parse_str(), the underlying #PHP function, still enforce backward compatible behaviors. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. Sometimes, you&apos;ll find underscores in your HTTP variables, where you expected other characters, like +, . or space.

parse_str(), the underlying #PHP function, still enforce backward compatible behaviors.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

So, you like characters and bytes? Let me introduce the superFoo(): + still with 3 characters + no multibyte characters + and now with strlen of 6. What do you say? #phptip #phptrick

exakat's tweet image. So, you like characters and bytes? Let me introduce the superFoo(): 

+ still with 3 characters 
+ no multibyte characters
+ and now with strlen of 6. 

What do you say? 

#phptip #phptrick

When using #PHP isset(), the language construct hides errors because, ... well... that's what is being tested there. Unless there is an object, where an array is expected. Then, it leads to a fatal error. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. When using #PHP isset(), the language construct hides errors because, ... well... that&apos;s what is being tested there.

Unless there is an object, where an array is expected. Then, it leads to a fatal error.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

A few days ago, I warned about isset() and a possible #PHP Fatal error. Given that isset() and ?? share the same code, it is not suprising that ?? hold the same trap. That bug should go away, the sooner the beter. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. A few days ago, I warned about isset() and a possible #PHP Fatal error.

Given that isset() and ?? share the same code, it is not suprising that ?? hold the same trap.

That bug should go away, the sooner the beter.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

There are, at least, 4 ways to create a closure in #PHP. They all will be callable later. On the other hand, they behave differently to check the underlying method. All is in the timing. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. There are, at least, 4 ways to create a closure in #PHP. They all will be callable later.

On the other hand, they behave differently to check the underlying method.

All is in the timing.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

It is easy to create a map from a list of object, using #PHP array_column() and the second argument null. That null represents the whole object, and the third argument is the indexing key. array_column($list_of_objects, null, 'id'); #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. It is easy to create a map from a list of object, using #PHP array_column() and the second argument null.

That null represents the whole object, and the third argument is the indexing key.

array_column($list_of_objects, null, &apos;id&apos;);

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

It is not possible to cast any #PHP enum cases to (string) or (int) even when... they are backed! That looks like a natural feature, though. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. It is not possible to cast any #PHP enum cases to (string) or (int) even when... they are backed! 

That looks like a natural feature, though.

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

Dynamic class constants is achieved with #PHP 8.3 class constant syntax, and the constant() function. It also applies to enumeration cases. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. Dynamic class constants is achieved with #PHP 8.3 class constant syntax, and the constant() function.

It also applies to enumeration cases. 

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

And since PHP 8.0, it is also possible to use the keys as named parameters. It solves the problem to put the arguments at the right place. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. And since PHP 8.0, it is also possible to use the keys as named parameters. It solves the problem to put the arguments at the right place. 

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

#PHP question of the day : when you know that 2*2 = 4 2^2 = 4 (too) 2.5^2.5 = 9.8821176880262.. Where is this 6 coming from ? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. #PHP question of the day : when you know that 
  2*2 = 4
  2^2 = 4 (too) 
  2.5^2.5 = 9.8821176880262..
Where is this 6 coming from ?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP has a 'precision' directive that controls the number of decimals displayed by float values. It default to 14, and peaks at 18, and gives up at 54. Use gmp for large numbers. When changing it, don't forget to reset it to default. php-tips.readthedocs.io/en/latest/tips… #phptip #phptrick

faguo's tweet image. #PHP has a &apos;precision&apos; directive that controls the number of decimals displayed by float values.

It default to 14, and peaks at 18, and gives up at 54. Use gmp for large numbers.

When changing it, don&apos;t forget to reset it to default.

php-tips.readthedocs.io/en/latest/tips…

#phptip #phptrick

TIL file_put_contents() accepts an array as second argument, and will do an implode("", $array) on it when writing. Who is using this feature? #phptip #phptrick cc /@Girgias php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. TIL file_put_contents() accepts an array as second argument, and will do an implode(&quot;&quot;, $array) on it when writing.  

Who is using this feature? 

#phptip #phptrick cc /@Girgias 

php-tips.readthedocs.io/en/latest/tips…

TIL that #PHP reports duplicate constant definitions in different interfaces. This is very unusual occurrence. So, shall we always give unique names across interfaces? Just avoid multiple interfaces with constants on the same class? #phptip #phptrick php-errors.readthedocs.io/en/latest/mess…

faguo's tweet image. TIL that #PHP reports duplicate constant definitions in different interfaces. This is very unusual occurrence.

So, shall we always give unique names across interfaces? Just avoid multiple interfaces with constants on the same class? 

#phptip #phptrick 

php-errors.readthedocs.io/en/latest/mess…

#PHP can type arguments, properties and returns. But can it type also local variables ? Well, it could, and for a long time. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. #PHP can type arguments, properties and returns. But can it type also local variables ?

Well, it could, and for a long time.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

When using a referenced argument, the type is checked but it is not garanteed. After execution, it might be different than initialy. Rare, but surprising. #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. When using a referenced argument, the type is checked but it is not garanteed. After execution, it might be different than initialy.

Rare, but surprising.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

In this code, #PHP complains about an unexpected semi-colon, which... doesn't exist. It is actually the closing tag, which acts as a end of command. #phptip #phptrick via @ryangjchandler php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. In this code, #PHP complains about an unexpected semi-colon, which... doesn&apos;t exist.

It is actually the closing tag, which acts as a end of command. 

#phptip #phptrick  via @ryangjchandler 

php-tips.readthedocs.io/en/latest/tips…

Indeed, the date() function doesn't support the u and v format characters, that provide milli and micro seconds. That might be a reason to move to new DateTime() and DateTimeImmutable(). #phptip #phptrick 3v4l.org/eFSme

faguo's tweet image. Indeed, the date() function doesn&apos;t support the u and v format characters, that provide milli and micro seconds. 

That might be a reason to move to new DateTime() and DateTimeImmutable().

#phptip #phptrick 

3v4l.org/eFSme

Since #PHP 8.4, we can have properties in interfaces! Thank you, property hooks! #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. Since #PHP 8.4, we can have properties in interfaces!

Thank you, property hooks!

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

TIL that it is possible to redefine #PHP functions and constants, using the 'use' command. This is not the case for classes (or any CITE) #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. TIL that it is possible to redefine #PHP functions and constants, using the &apos;use&apos; command. 

This is not the case for classes (or any CITE)

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP recursive methods are easy, because they have a name. What about closures? arrow functions? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. #PHP recursive methods are easy, because they have a name. 

What about closures? arrow functions? 

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

So, take a #PHP array, but some value in it (like, anything). Can you make an infinite loop out of this? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

exakat's tweet image. So, take a #PHP array, but some value in it (like, anything). 

Can you make an infinite loop out of this? 

#phptip #phptrick

php-tips.readthedocs.io/en/latest/tips…

#PHP doesn't allow the dynamic creation of class constants (nor methods, nor properties). So, don't try the code below : I did, it doesn't work. Now, how would you make a dynamic class constant, in spite of these limitation? #phptip #phptrick php-tips.readthedocs.io/en/latest/tips…

faguo's tweet image. #PHP doesn&apos;t allow the dynamic creation of class constants (nor methods, nor properties). So, don&apos;t try the code below : I did, it doesn&apos;t work. 

Now, how would you make a dynamic class constant, in spite of these limitation? 

#phptip #phptrick 

php-tips.readthedocs.io/en/latest/tips…

Loading...

Something went wrong.


Something went wrong.


United States Trends