Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I got a simple php issue which is that I don't know how to use substring here...

ABCDEF[RAND NUMBER 1-10000000]GH

And so I need to get that random number using substring,

I dont know if my brain works correctly today but I really couldnt figure how to do that.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
279 views
Welcome To Ask or Share your Answers For Others

1 Answer

Regex is always better in this case but If your string pattern is fixed like ABCDEF123456GH, you can simply use substr like

$str = "ABCDEF432465GH";
echo substr($str, 6, -2);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...