I am a novice at PHP I am just learning. But I have come across a problem that I am having real trouble with.
I am working inside WordPress with a plug-in and I am trying to shorten a string within that plug-in so it just displays a small amount of text instead of a large section.
I know from reading this website and other including PHP.net that I need to use 'substr' The main problem is I think I need to add more than the string.
In my working one that does not shorten there is something with the string in ['post_content'] I am not sure how that works with the syntax of PHP.
This is what I have come up with using the resources I found. Also adding ... to the end would be great.
if (strlen($property) > 15) // if you want...
$maxLength = 14;
$property = substr($property, 0, $maxLength);
And this is the working but without shortening
<?<em>php</em> echo $property['post_content']; ?>
Get first n characters of a string
Shorten a text string in PHP
Shorten string with a "..." body
1.gzcompress — Compress a string
This function compress the given string using the ZLIB data format.
— Create a gzip compressed string
This function return...
首先跟大家说明一点，我们做 IT 类的外包开发，是非标品开发，所以很有可能在开发过程中会有这样那样的需求修改，而这种需求修改很容易造成扯皮，进而影响到费用支付，甚至出现做完了项目收不到钱的情况。
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...