From 09bc39e0f61a0fecc3e57be73ac1a3224f59b614 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 20 Mar 2016 17:59:20 +0100 Subject: [PATCH] Reworded the example about $deep param --- components/http_foundation/introduction.rst | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 2604f3a4a72..62546cefb2b 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -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: