Unfortunately, no. This doesn’t identify or it misidentifies Opera, and Edge, because just finding those values in the strings doesn’t identify the browser.
For most of these client strings, the last entry is the identifying value. However, for Chrome, and a few mobile devices, it is the first value. Chrome and others also include Safari as the last entry. Safari only includes itself.
There are also variations in spelling, such as Edg, EdgA, and Edge all for Edge (microsoft doing their own thing again.) Opera is actually OPR.
I would do this positionally, by making an array of last entry ‘only’ values, that if found (in_array()) cause the last entry to be used. If the last entry ‘only’ comparison fails and Chrome is not found at all, use Safari. Otherwise use Chrome.
@Ulrik, what is your actual use for this? I hope it is only for display purposes or recording visits by client, because it isn’t exact and unless you make use of one of the browser client api’s, you will never be able to keep up with all the different values.