how can i remove the first forward slash?

user11338996

as you can see i show some breadcrumbs on my page. but i want to remove the first forward slash, how can i do that?

now it looks like this: / u are here: /home /page1 /page2

but it has to be like this: u are here: /home /page1 /page2

i already tried a lot but nothing seems to work.

This is my code:

                    <?php
                    $crumbs = explode("/", $_SERVER["REQUEST_URI"]);

                    foreach ($crumbs as $crumb) {
                        echo ucfirst(str_replace(foldernaam,'u are here: ', $crumb  . " /"));
                    }
                    ?>
Rohit

use this code:

$str = '/u are here /home /page1 /page2';
$str = ltrim($str, '/');
echo $str;

It will return you u are here /home /page1 /page2

You can also use this code:

$str = '/u are here /home /page1 /page2';
$strs = substr($str, 0);

But it will remove first character while the code given above will remove the first forward slash that is suitable solution of your query.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How can I remove the first element of a xarray.DataArray?

分類Dev

How can I remove the first whitespace of every line of a file?

分類Dev

How to have a forward slash in a file name?

分類Dev

How do I make this regular expression not match anything after forward slash /

分類Dev

How can I remove the left and right space from first & last images?

分類Dev

How to disable escaping forward-slash symbol in nested JsonLayout in NLog

分類Dev

How can I use a member function of a forward declared class?

分類Dev

How to remove last character with slash in unix?

分類Dev

Python regex get text between last forward slash and then before first hyphen

分類Dev

How can I keep the trailing slash after choosing a directory from the zsh completion options?

分類Dev

How can i remove a particular comma at end

分類Dev

How can I remove an applied git patch?

分類Dev

How can I remove a NavigableString from the tree?

分類Dev

How I can remove the node child in R

分類Dev

How can I remove "ImageMagick" completely?

分類Dev

What happens to the second forward slash?

分類Dev

GSUB and Forward Slash usage in Ruby

分類Dev

Forward slash not detected in "grep" command

分類Dev

How to remove forward slashes from a vector in R?

分類Dev

Can I avoid nested namespaces in forward declaration?

分類Dev

How can I replace the NULL values in dataframe with Average of Forward and backward fill?

分類Dev

How can I set up a remote port forward on port 80 to my localhost with the help of setcap?

分類Dev

.htaccess remove trailing slash

分類Dev

If I have a multidimentional array, how can I acsess only the first value of the first dimention?

分類Dev

How can I await an array of tasks and stop waiting on first exception?

分類Dev

How Can I get autofocus on the first element (buildform) symfony

分類Dev

VBA MS ACCESS: How can I fix first condition in if?

分類Dev

How can I start my pattern in first caractere

分類Dev

How can I ignore the first line break for a Positive Lookahead (regex)

Related 関連記事

  1. 1

    How can I remove the first element of a xarray.DataArray?

  2. 2

    How can I remove the first whitespace of every line of a file?

  3. 3

    How to have a forward slash in a file name?

  4. 4

    How do I make this regular expression not match anything after forward slash /

  5. 5

    How can I remove the left and right space from first & last images?

  6. 6

    How to disable escaping forward-slash symbol in nested JsonLayout in NLog

  7. 7

    How can I use a member function of a forward declared class?

  8. 8

    How to remove last character with slash in unix?

  9. 9

    Python regex get text between last forward slash and then before first hyphen

  10. 10

    How can I keep the trailing slash after choosing a directory from the zsh completion options?

  11. 11

    How can i remove a particular comma at end

  12. 12

    How can I remove an applied git patch?

  13. 13

    How can I remove a NavigableString from the tree?

  14. 14

    How I can remove the node child in R

  15. 15

    How can I remove "ImageMagick" completely?

  16. 16

    What happens to the second forward slash?

  17. 17

    GSUB and Forward Slash usage in Ruby

  18. 18

    Forward slash not detected in "grep" command

  19. 19

    How to remove forward slashes from a vector in R?

  20. 20

    Can I avoid nested namespaces in forward declaration?

  21. 21

    How can I replace the NULL values in dataframe with Average of Forward and backward fill?

  22. 22

    How can I set up a remote port forward on port 80 to my localhost with the help of setcap?

  23. 23

    .htaccess remove trailing slash

  24. 24

    If I have a multidimentional array, how can I acsess only the first value of the first dimention?

  25. 25

    How can I await an array of tasks and stop waiting on first exception?

  26. 26

    How Can I get autofocus on the first element (buildform) symfony

  27. 27

    VBA MS ACCESS: How can I fix first condition in if?

  28. 28

    How can I start my pattern in first caractere

  29. 29

    How can I ignore the first line break for a Positive Lookahead (regex)

ホットタグ

アーカイブ