Search
 
SCRIPT & CODE EXAMPLE
 

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 );
?>
Comment

PHP strrpos — Find the position of the last occurrence of a substring in a string

<?php

$pos = strrpos($mystring, "b");
if ($pos === false) { // note: three equal signs
    // not found...
}

?>
Comment

PHP strripos — Find the position of the last occurrence of a case-insensitive substring in a string

<?php
$haystack = 'ababcd';
$needle   = 'aB';

$pos      = strripos($haystack, $needle);

if ($pos === false) {
    echo "Sorry, we did not find ($needle) in ($haystack)";
} else {
    echo "Congratulations!
";
    echo "We found the last ($needle) in ($haystack) at position ($pos)";
}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: php array push 
Php :: php dirname 
Php :: use php artisan command through controller 
Php :: magento 1.9 get all product 
Php :: get array of last 3 dates with carbon 
Php :: composer install phpWord 
Php :: composer create project laravel with version 
Php :: 2 days left format in laravel 
Php :: how do i know if file is empty in php 
Php :: php send post request 
Php :: how to use wherehas in laravel 
Php :: laravel casts AsCollection 
Php :: laravel when query 
Php :: laravel edit form modal example 
Php :: custom pagination in laravel 
Php :: search query codeigniter 
Php :: php number multiple of 
Php :: php into javascript 
Php :: wp-config.php 
Php :: mktime syntax php 
Php :: specify php version composer 
Php :: php detect daylight saving time DST 
Php :: php language is used for 
Php :: italic text in laravel notification 
Php :: Drupal 9 entity.repository load entity by UUID 
Php :: Laravel Nested whenLoaded 
Php :: flutter fetch database from mysql using php 
Php :: php move in array 
Php :: Before Action methoond in Yii 1 controller 
Php :: php absint 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =