hoops Established Member ★ 15 ★ Impact 0 Sep 29, 2010 1K views 7 replies #1 I have a PHP script that pulls a .txt file and displays the results for me. I need the scipt to limit the number of letters it shows to me to not more than 15 letters, but not 15 letters exactly. Can someone show me a code example on how to do this please? Thanks!
I have a PHP script that pulls a .txt file and displays the results for me. I need the scipt to limit the number of letters it shows to me to not more than 15 letters, but not 15 letters exactly. Can someone show me a code example on how to do this please? Thanks!
yilduz Your face is regfee!Established Member ★ 15 ★ Impact 30 Sep 29, 2010 #2 What do you mean exactly? Why not always show 15 characters? In which cases do you want it to show less than 15?
What do you mean exactly? Why not always show 15 characters? In which cases do you want it to show less than 15?
hoops Established Member ★ 15 ★ Impact 0 Sep 30, 2010 #3 yilduz said: What do you mean exactly? Why not always show 15 characters? In which cases do you want it to show less than 15? Click to expand... Yes less than 15 characters.
yilduz said: What do you mean exactly? Why not always show 15 characters? In which cases do you want it to show less than 15? Click to expand... Yes less than 15 characters.
Deathstarr VIP Member VIP ★ 20 ★ Impact 118 Sep 30, 2010 #4 So you want to pull the data from a txt file and show results for words with 1-15 letters. Correct?
hoops Established Member ★ 15 ★ Impact 0 Sep 30, 2010 #5 DotElement said: So you want to pull the data from a txt file and show results for words with 1-15 letters. Correct? Click to expand... Yes - I have all of the code and it works find with displaying the characters, but I need from 1-15 characters only. Here is the line that I think needs to be edited. $length = (strlen($length) > 0) ? $length : null;
DotElement said: So you want to pull the data from a txt file and show results for words with 1-15 letters. Correct? Click to expand... Yes - I have all of the code and it works find with displaying the characters, but I need from 1-15 characters only. Here is the line that I think needs to be edited. $length = (strlen($length) > 0) ? $length : null;
B baxter Established Member ★ 15 ★ Impact 17 Oct 2, 2010 #7 If your using this in a loop of strings below will allow anything greater then 0 characters and less then 15 characters Code: $length = (strlen($length) > 0 AND strlen($length) <= 15) ? $length : null;
If your using this in a loop of strings below will allow anything greater then 0 characters and less then 15 characters Code: $length = (strlen($length) > 0 AND strlen($length) <= 15) ? $length : null;
J johanwhite New Member ★ 15 ★ Impact 0 Nov 19, 2010 #8 I think you want just 1-15 letters. Then you should try the following code. $length = (strlen($length) >= 1 AND strlen($length) <= 15) ? $length : null; I hope after using this code, you will solve your problem. Thank you.
I think you want just 1-15 letters. Then you should try the following code. $length = (strlen($length) >= 1 AND strlen($length) <= 15) ? $length : null; I hope after using this code, you will solve your problem. Thank you.