how do i remove a letter from string

solink

i have string like example

    $str = 'wap,net,web,andothers';

in my achievement i want to remove web from the string line so my expected result should be like wap,net,andothers i try with

     $str = 'wap,net,web,andother';

       $remove = 'web';  
     $str = ltrim($str, ' $remove');

   var_dump($str);

but could not achieve it

big thanks in advance

Rotimi

Here i explode it and then filter out the keyword web

<?php
$str = 'wap,net,web,andother';
$explode = explode(',',$str);
$result = [];

foreach($explode as $value){
    if($value !== 'web'){
        $result[] = $value;
    }
}

print_r(implode(',',$result));

?>

or simply, use php str_replace

$str = 'wap,net,web,andother';
$stringToRemove = 'web';

print_r(str_replace($stringToRemove,'',$str));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do i make random letter from a string?

From Dev

How do I remove CSS from a string?

From Dev

How Do I Remove A Vowel From String

From Dev

How do i remove chars from a string?

From Dev

How do I remove punctuaution from a string

From Dev

How can I remove all non-letter characters from a string in Java?

From Dev

How do I remove a character from a string in a Unix shell script?

From Dev

How do I remove all occurrences of a specific char from a string?

From Dev

How do I remove multiple offending characters from my string?

From Dev

How do I remove \r\n from string in C#?

From Dev

How do I remove a string from an array in a mongodb document?

From Dev

How do I remove a character from a list or string in Erlang?

From Dev

How do I remove new line characters from a string?

From Dev

How do I remove part of a string from a specific character?

From Dev

How do I remove a character from a string in a Unix shell script?

From Dev

How do i remove all white spaces from a string?

From Dev

How do I remove \r\n from string in C#?

From Dev

How do I remove a character once from a string [python]?

From Dev

How do I remove the first n characters from a string in c?

From Dev

How do I remove a textline from string with javascript?

From Dev

How do I remove the last characters from a string?

From Dev

How do I remove a character from a string in c++?

From Dev

How do I remove a query string from the URL in Wordpress?

From Dev

How do I make a single letter in a string uppercase

From Dev

How do I add a specific letter to a variable and then make it a string

From Dev

How do I slice a string in python based on the text, not the letter number?

From Dev

How do I create a method that capitalizes the first letter of a string in java?

From Dev

How do I grab each letter of a string in android?

From Dev

How do I identify in a string that a letter has a number beside?

Related Related

  1. 1

    How do i make random letter from a string?

  2. 2

    How do I remove CSS from a string?

  3. 3

    How Do I Remove A Vowel From String

  4. 4

    How do i remove chars from a string?

  5. 5

    How do I remove punctuaution from a string

  6. 6

    How can I remove all non-letter characters from a string in Java?

  7. 7

    How do I remove a character from a string in a Unix shell script?

  8. 8

    How do I remove all occurrences of a specific char from a string?

  9. 9

    How do I remove multiple offending characters from my string?

  10. 10

    How do I remove \r\n from string in C#?

  11. 11

    How do I remove a string from an array in a mongodb document?

  12. 12

    How do I remove a character from a list or string in Erlang?

  13. 13

    How do I remove new line characters from a string?

  14. 14

    How do I remove part of a string from a specific character?

  15. 15

    How do I remove a character from a string in a Unix shell script?

  16. 16

    How do i remove all white spaces from a string?

  17. 17

    How do I remove \r\n from string in C#?

  18. 18

    How do I remove a character once from a string [python]?

  19. 19

    How do I remove the first n characters from a string in c?

  20. 20

    How do I remove a textline from string with javascript?

  21. 21

    How do I remove the last characters from a string?

  22. 22

    How do I remove a character from a string in c++?

  23. 23

    How do I remove a query string from the URL in Wordpress?

  24. 24

    How do I make a single letter in a string uppercase

  25. 25

    How do I add a specific letter to a variable and then make it a string

  26. 26

    How do I slice a string in python based on the text, not the letter number?

  27. 27

    How do I create a method that capitalizes the first letter of a string in java?

  28. 28

    How do I grab each letter of a string in android?

  29. 29

    How do I identify in a string that a letter has a number beside?

HotTag

Archive