0
A
回答
1
$source = array(
0 => '\'268',
1 => '252',
);
function strip($element)
{
$matches = array();
preg_match('#[0-9]+#', $element, $matches);
return (int)reset($matches);
}
$result = array_map('strip', $source);
var_dump($result);
与结果:
array (size=2)
0 => int 268
1 => int 252
+0
谢谢。我做了很长很久的努力,但这看起来更容易:)。我使用$ tcx =(int)(trim($ tc2 [0],''''); $ tcy =(int)(trim($ tc2 [1],“'”);并且返回给我两个字符串。我假设我不需要在最终代码中执行var_dump($ result)? – MSM
相关问题
- 1. 从数组中提取值
- 2. 从数组中提取值
- 3. 从字段数组中提取文本
- 4. 从函数中提取数组值
- 5. 从JavaScript数组中提取值
- 6. 从哈希数组中提取键值?
- 7. 从数组中提取的值
- 8. 从JSON数组中提取键/值对
- 9. 从数组中提取重要值
- 10. PHP:从多维数组中提取值
- 11. Javascript。从关联数组中提取值
- 12. 从JSON数组中提取值
- 13. 从对象数组中提取值
- 14. 从多维数组中提取值
- 15. 从数组中提取变量值
- 16. 从文本文件中提取数据
- 17. 从文本文件中提取数据
- 18. 从文本文件中提取数据
- 19. 如何从Javascript中的数组数组中提取值?
- 20. 从文件中提取字节数组
- 21. 从C文件中提取int数组
- 22. 从文本文件中读取数组
- 23. 在Java从文件中提取数值
- 24. Scala从数组和嵌套数组中提取值
- 25. 从文本文件中提取数据 - !!!!重复值
- 26. 从文件中提取double值到数组中
- 27. 如何从文本中提取数字?
- 28. 从文本框中提取数字
- 29. 从文本框中提取数字
- 30. Python从文本行中提取数据
什么是您预期的输出??? – Baba
两个字符串或两个整数,但只是数字,没有特殊字符。 – MSM