使用php从字符串中提取前5个和后5个字符? [英] extract first 5 and last 5 characters from a string using php?

查看:113
本文介绍了使用php从字符串中提取前5个和后5个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MD5字母数字.如何获得前五个字符和后五个字符,并使用PHP将它们放在一个字符串中?

I have an MD5 alpha-numeric. How can I get the first five characters and last five characters, and put them in one string using PHP?

例如:" aabbc cddeef fgghh "将变为"aabbcfgghh".

For example: "aabbccddeeffgghh" will become "aabbcfgghh".

推荐答案

首先-接受您的最新答案.

First of all - accept your recent answers.

您可以使用 substr 函数执行此操作:

$input  = 'aabbccddeeffgghh';
$output = substr($input, 0, 5) . substr($input, -5);

这篇关于使用php从字符串中提取前5个和后5个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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