Answer the question
In order to leave comments, you need to log in
How to make such a regular expression in PHP?
Guys, help me how to make such a regular routine.
For example, there is a text: hi / et / how / are you doing /
And do this: hi / et / how /
That is, delete everything after the third /
Answer the question
In order to leave comments, you need to log in
<?php
$s='прив/ет/как/дела/';
$s=explode('/',$s,4);
$s[3]='';
$s=implode('/',$s);
var_dump($s); //прив/ет/как/
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question