Skip to content

Commit

Permalink
Reworded the example about $deep param
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Mar 20, 2016
1 parent f82b32e commit 09bc39e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions components/http_foundation/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,28 @@ exist::
// the query string is '?foo=bar'

$request->query->get('foo');
// returns bar
// returns 'bar'

$request->query->get('bar');
// returns null

$request->query->get('bar', 'bar');
// returns 'bar'
$request->query->get('bar', 'baz');
// returns 'baz'

When PHP imports the request query, it handles request parameters like
``foo[bar]=bar`` in a special way as it creates an array. So you can get the
``foo`` parameter and you will get back an array with a ``bar`` element::

// the query string is '?foo[bar]=bar'
// the query string is '?foo[bar]=baz'

$request->query->get('foo');
// returns array('bar' => 'bar')
// returns array('bar' => 'baz')

$request->query->get('foo[bar]');
// returns null

$request->query->get('foo')['bar'];
// returns 'bar'
// returns 'baz'

.. _component-foundation-attributes:

Expand Down

0 comments on commit 09bc39e

Please sign in to comment.