Skip to content

Commit

Permalink
minor #6390 Reworded the example about $deep param (Oliboy50, javiere…
Browse files Browse the repository at this point in the history
…guiluz)

This PR was merged into the 2.8 branch.

Discussion
----------

Reworded the example about $deep param

This finishes #6333.

Commits
-------

09bc39e Reworded the example about $deep param
f82b32e [HttpFoundation] ParameterBag::get() $deep param
  • Loading branch information
xabbuh committed Mar 26, 2016
2 parents c9b54db + 09bc39e commit 8666655
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
// returns null

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

.. _component-foundation-attributes:

Expand Down

0 comments on commit 8666655

Please sign in to comment.