Parse text between 2 words

后端 未结 5 1313
慢半拍i
慢半拍i 2021-01-20 23:51

For sure this has already been asked by someone else, however I\'ve searched here on SO and found nothing https://stackoverflow.com/search?q=php+parse+between+words

I ha

5条回答
  •  余生分开走
    2021-01-21 00:20

    You can also use two explode statements.

    For example, say you want to get "z" in y=mx^z+b. To get z:

    $formula="y=mx^z+b";
    $z=explode("+",explode("^",$formula)[1])[0];
    

    First I get everything after ^: explode("^",$formula)[1]

    Then I get everything before +: explode("+",$previousExplode)[0]

提交回复
热议问题