Jump to content

Removing words in a string


dominod

Recommended Posts

Are there more words in the string? If not, you can use the explode function:

<?php
$str = "word: 1234";
$tmp = explode(':',$str);
echo $tmp[1];
?>

or

<?php
$str = 'word: 1234';
list($dmy,$word) = explode(':',$str);
echo $word;
?>

 

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.