Espace membres

Bonjour Anonyme

Inscription

Email :
Mot de passe :

Mot de passe oublié ?

Nos scripts

MySpeach

MySpeach est un chat php sans base de donnée, rapide, léger et facile à prendre en main. DEMO

MyPHPUpload

MyPHPUpload est un script d'upload sécurisé écrit en PHP. DEMO

GrapAgenda

Agenda PHP et MySQL avec comptes utilisateurs et administration. DEMO

Livre PHP

création de site

Fonction substring php

Cours / tutoriel écrit le 17-06-2010 par sky

substring

(PHP 3, PHP 4 )
Retourne un segment de chaîne
string substr ( string string, int start [, int length])
substr() retourne le segment de string définit par start et length. Si start est positif, la chaîne retournée commencera au caractère numéro start, dans la chaîne string. Le premier caractère est numéroté zéro.

Le code :
 <?php
echo substr("abcdefghij", 2);
echo "<br />";
echo substr("abcdefghij", 0, 3);
echo "<br />";
echo substr("abcdefghij", 1, 4);
echo "<br />";
echo substr("abcdefghij", 5, 20);
echo "<br />";
echo substr("abcdefghij", -3, 2);
?>

Affichera :
cdefghij
abc
bcde
fghij
hi

Commentaires

salah le 11-02-2011

merci

Pseudo
Email
Commentaire

Merci d'écrire le code ici :