I
I
ilysion_in_life2018-04-19 10:12:40
PHP
ilysion_in_life, 2018-04-19 10:12:40

How to remove the file extension through in the list through the line?

Hello everyone, guys, tell me how to remove the file extension in the list if the extension is through the line
KX5-1
28346.mp4
KX5-2
28347.mp4
KX5-3
28348.mp4
as an example ,
I need to remove .mp4 tried various ways and regular expressions and it doesn’t work, the list is spoiled
list like this

foreach($matches as $vals)
      {
        for ($i=0; $i<count($vals); $i++)
        echo "<li><i>$vals[$i]</i></li>";
      }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Gavrilovich, 2018-04-19
@nikgavrilovich

You create the second empty array and copy the data element by element from the first array. If the string has an extension (check pregmatch) - cut off the extension with the usual substr and put it in the second array

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question