PHP Help

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

hoops

Established Member
Impact
0
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!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
What do you mean exactly? Why not always show 15 characters? In which cases do you want it to show less than 15?
 
0
Close
What do you mean exactly? Why not always show 15 characters? In which cases do you want it to show less than 15?

Yes less than 15 characters.
 
0
Close
So you want to pull the data from a txt file and show results for words with 1-15 letters. Correct?
 
0
Close
So you want to pull the data from a txt file and show results for words with 1-15 letters. Correct?

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;
 
0
Close
PHP:
$catString = substr($length,0,15);
 
0
Close
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;
 
0
Close
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.
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back