PHP从数组的每个元素中获取我需要的东西 [英] PHP taking just what I need from each element of an array

查看:81
本文介绍了PHP从数组的每个元素中获取我需要的东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我想知道如何在php中从我的数组的每个元素中获取所需的内容。我只需要>之间的部分。和<并且可以删除其余部分。



任何帮助将不胜感激!谢谢!



Barton

Hello,
I was wondering how to take just what I need from each element of my array in php. I need just the parts between > and < and can delete the rest.

Any help would be much appreciated! Thanks!

Barton

推荐答案

你应该学习php字符串函数。

You should study the php string functions.
strstr(


elem,>,true) - 在>之前返回字符串的一部分
strstr(
elem,">", true) - returns part of string before ">" strstr(


elem,<,false) - 在<之后返回字符串的一部分
elem,"<", false) - returns part of string after "<"



从这一点开始,你应该能够解决这个问题。




这篇关于PHP从数组的每个元素中获取我需要的东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆