Use an expression to select an array value in PHP. It's handy for quick output logic. Update: it's a bit too clever, perhaps, versus using the tenary operator.

$classes .= [ ' sort-default', ' sort-custom' ][ has_custom_sort( $post ) ];

#php #technology #tips

January 31 at 11:57 am

Related posts

  • January 31 at 11:57 am
  • January 2 at 9:59 am PHP-Activate 0.3.1
  • December 15 at 9:47 am PHP-Activate 0.3.0
  • October 5 at 8:59 am PHP-Activate 0.2.0
  • March 21 at 2:28 pm
  • March 21 at 12:41 pm Basic routing using REQUEST_URI
  • Wednesday at 11:07 am Navigate Xbox Series console using LG remote
  • February 12 at 10:38 am
  • January 31 at 2:30 pm
  • January 23 at 11:21 am
  • January 16 at 4:33 pm
  • January 3 at 2:07 pm
  • January 2 at 4:37 pm
  • December 11 at 8:51 am
  • November 14 at 10:08 am
  • September 22 at 9:12 am On personal goals
  • September 9 at 12:56 pm
  • August 3 at 9:03 am Anchor bugs in Blink engine browsers
  • April 10 at 10:41 am
  • April 6 at 10:43 am
  • March 24 at 7:24 am