Skip to content

Commit 8666655

Browse files
committed
minor symfony#6390 Reworded the example about $deep param (Oliboy50, javiereguiluz)
This PR was merged into the 2.8 branch. Discussion ---------- Reworded the example about $deep param This finishes symfony#6333. Commits ------- 09bc39e Reworded the example about $deep param f82b32e [HttpFoundation] ParameterBag::get() $deep param
2 parents c9b54db + 09bc39e commit 8666655

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

components/http_foundation/introduction.rst

+9-6
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,28 @@ exist::
147147
// the query string is '?foo=bar'
148148

149149
$request->query->get('foo');
150-
// returns bar
150+
// returns 'bar'
151151

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

155-
$request->query->get('bar', 'bar');
156-
// returns 'bar'
155+
$request->query->get('bar', 'baz');
156+
// returns 'baz'
157157

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

162-
// the query string is '?foo[bar]=bar'
162+
// the query string is '?foo[bar]=baz'
163163

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

167167
$request->query->get('foo[bar]');
168-
// returns null
168+
// returns null
169+
170+
$request->query->get('foo')['bar'];
171+
// returns 'baz'
169172

170173
.. _component-foundation-attributes:
171174

0 commit comments

Comments
 (0)