PHP natively doesn't allow for this.
First attempts in PHP to create "nice" urls where the path expressed a series of objects and methods or "variables" as you say were done by using mod_rewrite.
I have done this; to me url design (this predates REST as an architectural style but was alone the same lines of thinking) is important. It encourages good clean app design and helps ensure your URL's will have a fair chance of being permanent.
But using mod_rewrite and equiv. is horribly clunky and cumbersome, especially if you have a url schema that is more than just a couple of objects and methods.
That's one of the reasons I left PHP years ago, in favour of Python.
At the time Zope (and its ancestors) had a very cool method of exposing an object via the web that gave you sensible URL's by default, for example:
No need to embed the term "search" in there when what you want is the "car" object.
Anyway, I looked into Zope. It had a lot of power but was overly complex. At the same time another Python web framework that essentially replicated the same technique for "publishing objects via the web" was born called Quixote. I've been using Quixote or its cousin QP ever since.
Now PHP has "web frameworks" too, but at the time there was essentially nothing of similar power, and the language itself lacked the type of expressiveness that Python had. I went from being a relatively experienced PHP (and ASP of the day) developer to a Python newbie, totally wet behind the ears, but was doing project work at double the effectiveness or more within just a few weeks.
Quixote, QP (and a terrific object database called Durus):
Zope, the grandaddy of them all:
The most visible Python web frameworks out there these days all do what QP and Quixote and Zope have been doing for years - and are also worth serious consideration:
Ruby, another object oriented language, also has an extremely popular web framework called Rails:
Quite often a developer given Python or Ruby code to look at will intuitively prefer one or the other. They have different styles. Python is probably easier to learn as it reads more like english; experienced developers coming from other languages such as Java would find either fits their brain but one will appear more. Pick either, both are good. I happen to prefer the look and readability of Python.
Hopefully someone will point out some PHP frameworks that do something similar to "object publishing".