A
A
adrenalinruslan2018-09-05 21:04:02
Regular Expressions
adrenalinruslan, 2018-09-05 21:04:02

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

1 answer(s)
X
xmoonlight, 2018-09-05
@adrenalinruslan

<?php
$s='прив/ет/как/дела/';
$s=explode('/',$s,4);
$s[3]='';
$s=implode('/',$s);
var_dump($s); //прив/ет/как/
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question