מדריך PHP קודם הבא Substr returns the portion of string specified by the start and length parameters. If start is positive, the returned string will start at the start 'th position in string, counting from zero. דוגמה 1. $rest = substr( "abcdef", 1); / / returns "bcdef "$rest = substr("abcdef", 1, 3); / / returns "bcd" $rest = substr("abcdef", 0, 4); / / returns "abcd "$rest = substr("abcdef", 0, 8); / / returns "abcdef" דוגמה 2. $rest = substr( "abcdef", -1); / / returns "f "$rest = substr("abcdef", -2); / / returns "ef" $rest = substr("abcdef", -3, 1); / / returns "d " If length is given and is positive, the string returned will contain at most length characters beginning from start (depending on the length of string. דוגמה 3. $rest = substr( "abcdef", 0, -1); / / returns "abcde "$rest = substr("abcdef", 2, -1); / / returns "cde" $rest = substr("abcdef", 4, -4); / / returns "" $rest = substr("abcdef", -3, -1); / / returns "de " קודם ראשי הבא strtr למעלה substr_count