<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: underscore code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 17:56:51 GMT</pubDate>
    <description>DZone Snippets: underscore code</description>
    <item>
      <title>Convert string to underscore_name</title>
      <link>http://snippets.dzone.com/posts/show/2681</link>
      <description>Converts "My House" to "my_house".&lt;br /&gt;Converts " Peter's nice car " to "peters_nice_car".&lt;br /&gt;Converts "_88" to "88"&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function string_to_underscore_name($string)&lt;br /&gt;{&lt;br /&gt;    $string = preg_replace('/[\'"]/', '', $string);&lt;br /&gt;    $string = preg_replace('/[^a-zA-Z0-9]+/', '_', $string);&lt;br /&gt;    $string = trim($string, '_');&lt;br /&gt;    $string = strtolower($string);&lt;br /&gt;    &lt;br /&gt;    return $string;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 23 Sep 2006 17:52:55 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2681</guid>
      <author>stancell (Algimantas Stancelis)</author>
    </item>
  </channel>
</rss>
