Jump to content

String manipulation help


extrovertive

Recommended Posts

User the explode(), ucword(), and implode() functions:

<?php
$strs = array('body-pop','big-c','t-cat-man');
foreach ($strs as $str) {
  $tmp = explode('-',$str);
  for ($i=1;$i<count($tmp);$i++)
      $tmp[$i] = ucwords($tmp[$i]);
  echo 'Original: ' . $str . ' ---> ' . implode('',$tmp) . '<br>';
}
?>

 

Ken

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.