(Update: I have documented proof that I am backslash/forwardslash challenged. Sorry for mixing them up. I think I got them right this time)
A bright young developer who works for my client is building a PHP app and is going to consume data from an ADO.NET Data Service that I built.
He was trying to build a URI by inserting a variable for a query filter and ran into trouble.
The reason is that PHP uses $ to identify variables.
$animal = “cat”
“The $animal ate the mouse”
The service URI depends on $ to apply operators.
“http://mydomain\myservice.svc/Animals?$filter animalname eq ‘cat’” (fixed the direction of the URI slashes)
PHP was confusing the operator for a variable.
“http://mydomain\myservice.svc/Animals?$filter animalname eq $animal” (fixed the URI slashes)
I figured there must be a way to escape that similar to how we need to escape < and > to display them in html.
Thanks to a thread on the www.faqts.com website, I found this blog post: How can I format currency properly in PHP?
and the answer which is to escape the $ sign with “\”
“http://mydomain/myservice.svc/Animals?\$filter animalname eq $animal” (fixed the direction of the slashes)
This the only code I’ve ever seen or written in PHP. Don’t make any leaps that I’m going to go too much further for now. I have a litany of new things to learn that will certainly come before PHP!



