Search
 
SCRIPT & CODE EXAMPLE
 

PHP

substr() php


<?php
echo substr('abcdef', 1);     // bcdef
echo substr('abcdef', 1, 3);  // bcd
echo substr('abcdef', 0, 4);  // abcd
echo substr('abcdef', 0, 8);  // abcdef
echo substr('abcdef', -1, 1); // f

// Accessing single characters in a string
// can also be achieved using "square brackets"
$string = 'abcdef';
echo $string[0];                 // a
echo $string[3];                 // d
echo $string[strlen($string)-1]; // f

?>

//substr() function returns certain bits of a string 
Comment

php substr

<?php
$rest = substr("abcdef", 0, -1);  // "abcde"
$rest = substr("abcdef", 2, -1);  // "cde"
$rest = substr("abcdef", 4, -4);  // false
$rest = substr("abcdef", -3, -1); // "de"
Comment

substr php

<?php
// Return "world" from the string:
echo substr("Hello world", 6);
?>
Comment

php substr

<?php
$rest = substr("abcdef", -1);    // returns "f"
$rest = substr("abcdef", -2);    // returns "ef"
$rest = substr("abcdef", -3, 1); // returns "d"
?>
Comment

PREVIOUS NEXT
Code Example
Php :: FPDF invoice Tutorial 
Php :: switch between php version ubuntu 
Php :: The "AppEntity entity has a repositoryClass set to but this is not a valid class. 
Php :: get number of days between two dates php 
Php :: php get last index of array 
Php :: insert into database with seeder 
Php :: mail() function in php not working 
Php :: enable extensions in php.ini 
Php :: wordpress popular posts query 
Php :: how to search like in php 
Php :: laravel 9 route group 
Php :: php run command terminal 
Php :: add phpmyadmin login linux 
Php :: fillable vs guarded laravel 
Php :: Return length of string PHP 
Php :: php include multiple files at once 
Php :: Diferencia entre dias PHP - Con date_diff() 
Php :: Best Security tools for php 
Php :: install bcmath php 7.3 ubuntu 
Php :: PHP Ternary Operator With Elseif Example 
Php :: Using the PHPExcel library to read an Excel file and transfer the data into a database 
Php :: wordpress change slug programmatically 
Php :: php check if day in month 
Php :: asset function in laravel not working 
Php :: Parse error: syntax error, unexpected token "{" in C:xampphtdocsloginsystem1welcome.php on line 3 
Php :: sms laravel 
Php :: SUM with Eloquent 
Php :: fakestore api data in laravel 
Php :: show phpinfo just modules 
Php :: laravel move/rename file ftp 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =