View Single Post
Old 01-09-2023, 09:03 AM   #470
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,480
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
How is switch() meant to be used? Here, I got overdrive.png when I was expecting drm-locked.png, so I think I either
a) misunderstood the syntax
b) misunderstood what instances it's meant to be used in:
You misunderstand the syntax. The first argument is a value, perhaps a $column selector. The rest of the arguments are (pattern, value) pairs. The pattern is checked against the first argument. If it matches then the value is returned.

The syntax you are using is switch_if().
chaley is offline   Reply With Quote