我对PHP相当陌生,我需要根据值而不是字符数将字符串剪切成特定的部分。在PHP中将字符串切成不同的部分?
我听说过爆炸函数和子字符串,但我不知道如何使用它来实现我想要的。
我有一个输出字符串:
Name: example Email: [email protected] Website: http://examples.com/ Comment: this is where the comment goes, we can't use explode because there's lots of spaces here Another comment: this is another comment Some random info: this is more info...
我想显示单独的行出于美观的目的这一信息。
有没有办法在特定单词之后但在另一个特定单词之前返回单词?
你熟悉数组? – MonkeyZeus
@Haudegen有所有应有的尊重,OP现在无法弄清楚爆炸和子串,你建议REGEX? – MonkeyZeus
哈哈,我知道RegEx是什么,但我不知道如何使用它。我也知道子字符串是干什么的,但是这样会减少字符数量的字符串,我不是在寻找。爆炸也没有帮助,因为我没有分隔字符串的不同部分(例如name:name; email:email;) – user3313191