Dots and spaces in variable names are converted to underscores.

From: Date: Wed, 20 Jan 2010 21:45:20 +0000
Subject: Dots and spaces in variable names are converted to underscores.
Groups: php.internals 
Request: Send a blank email to internals+get-46841@lists.php.net to get a copy of this message
Dots and spaces in variable names are converted to underscores. For
example <input name="a.b" /> becomes $_POST["a_b"].

Any reason why? and any way to modify this behaviour to preserve dots
and spaces? (dots specifically)

reason, when building "linked data" / rdf based applications using PHP
it's most beneficial to use subject / predicate URIs (eg
http://xmlns.com/foaf/0.1/mbox) as form input names.

also worth noting that if you send:
  <input name="a.b[c.d]" />
you'll receive the following in php:
  $_POST[a_b] => array('c.d' => val)
note no conversion of c.d to c_d

regards,

Nathan


Thread (22 messages)

« previous php.internals (#46841) next »