小编Geo*_*rge的帖子

如何使用PHP在字符串中查找内容

我对PHP有点绿色,因为我以前在ASP经典编码,它真的不一样

我有3个包含以下文本的字符串:

$str1 = "is simply dummy text of the printing $$ 6/4r $$ and typesetting industry"
$str2 = "is simply dummy text of the printing $$ 11/11tr $$ and typesetting industry"
$str3 = "is simply dummy text of the printing $$ 15/6 $$ and typesetting industry"
Run Code Online (Sandbox Code Playgroud)

我怎样才能获得6/4r,11/11tr并且15/6出单独的变量?

  1. 我认为这就像搜索一样 $$
  2. 问,下一个char是一个空间吗?
  3. 问,下一个字母是一个数字吗?
  4. 问,是下一个字母'/'

当所有这些都是真的时,我想抓住6/4r并把它放在一个单独的var中.

我怎么能用PHP做到这一点?

php

0
推荐指数
1
解决办法
300
查看次数

标签 统计

php ×1