<?php $sep = "long string"; $text = "blablablablablablablabla-long strin"; $last = $text[strlen($text) -1]; $offset = 0; while (($pos = strpos($sep, $last, $offset)) !== false) { $subsep = substr($sep, 0, $pos + 1); $sublen = strlen($subsep); if (substr_compare($text, $subsep, -$sublen) === 0) { echo substr($text, 0, -$sublen); break; } $offset = $pos + 1; }
You have javascript disabled. You will not be able to edit any code.