[ create a new paste ] login | about

Link: http://codepad.org/rGrbj9za    [ raw code | output | fork ]

PHP, pasted on Jan 24:
1
2
3
4
5
6
7
<?php

$path = '/somewhere/somefile.jpg';

$withoutExt = preg_replace('/\.' . preg_quote(pathinfo($path, PATHINFO_EXTENSION), '/') . '$/', '', $path);

echo $withoutExt;


Output:
1
/somewhere/somefile


Create a new paste based on this one


Comments: