Announcement

Collapse
No announcement yet.

Simple PHP Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple PHP Question

    Well I am sure this is pretty basic.... I have a variable with something like "[email protected]". I want to replace all the "." and "_" characters with a space, and strip off anything after the @ sign to come up with something like "Christopher Schreiber".

    Thanks,
    -Chris

  • #2
    Here is how I would do it (code tested and works).

    $var = "[email protected]";

    $name = explode("@",$var);

    $name[0] = str_replace("."," ",$name[0]);
    $name[0] = str_replace("_"," ",$name[0]);

    Comment


    • #3
      That worked great! Thanks

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X