Not sure if anybody has responded to your request?
Welcome to Webmaster World.
I've personally no clue whether the lines you've provided are PHP or something else.
"cloaking" is a controversial topic and requires delicacy to insure that SE's will be able to interpret your intentions as serving "focused content to specific users", as opposed to "cloaking with the intent to deceive either the visitors or the SE's".
The SE's do their own "cloaking" (even though that's not an accurate description, it amounts to the same thing) to serve content based on browser, region and even other crieteria's.
From a webmaster's point-of-view, if the SE's allow themselves to divert traffic more efficiently (with the visitor in mind), why shouldn't the webmaster be allowed the same tool?