PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 1, 2022

[FIXED] php - How can I check if the sentence consists of a single word?

 March 01, 2022     laravel-5, php     No comments   

Issue

For example;

"Real Madrid" -> false
"Barcelona  " -> true

with what functions can I solve this in laravel?


Solution

you can use

$result = explode(' ', trim("barcelona "));
print_r($result);

trim will remove all white space at the beginning and the end of your string



Answered By - Florent Cardot
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing