Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
Cómo verificar si más de un espacio o comienzo tiene espacio en PHP
  1. Hello World
  2. Hello World
  3. hello world

    o si el principio tiene espacio
  4. Hello World

Funciona si $q tiene valores normales, pero obtengo el valor de $q de la entrada de búsqueda , por lo que no funciona excepto en el caso 1.

 $q = Input::get('q'); if(preg_match("/^\s+/", $q) || preg_match("/\s{2,}/", $q)) { echo 'Found Spaces'; }
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

En lugar de Input::get('q'); use $q = $_GET['q'];
Entonces tu código se convierte en:

 $q = $_GET['q']; if(preg_match("/^\s+/", $q) || preg_match("/\s{2,}/", $q)) { echo 'Found Spaces'; }
over 4 years ago · Santiago Trujillo Report

0

if(preg_match("/^\s+/", $q) || preg_match("/\s{2,}/", $q)) { }
over 4 years ago · Santiago Trujillo Report

0

/\s+/g
  • \s para que coincida con el espacio.
  • + a dicho al menos uno.
  • g etiqueta global, todas las coincidencias.
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!