Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

PHP strrchr — Find the last occurrence of a character in a string

<?php
// get last directory in $PATH
$dir = substr(strrchr($PATH, ":"), 1);

// get everything after last newline
$text = "Line 1
Line 2
Line 3";
$last = substr(strrchr($text, 10), 1 );
?>
Source by onecompiler.com #
 
PREVIOUS NEXT
Tagged: #PHP #strrchr #Find #occurrence #character #string
ADD COMMENT
Topic
Name
8+1 =