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

237
Views
Leer una serie de números de un archivo txt en una matriz con JSON, pero ahora cada dígito está separado

Así que usé JSON para obtener una serie de números de .txt en una matriz en JavaScript, pero una vez que intento registrarlos con algo como console.log (testbodysnake [0] [0]) solo obtengo el corchete [ en lugar de el siguiente número.

 This is what it looks like in the .txt file [(400, 160)] [(400, 140)] [(400, 120)] [(400, 100)]
 The output is logged like this console.log(testbodysnake[0][0],testbodysnake[0][1], testbodysnake[0][2], testbodysnake[0][3], testbodysnake[0][4], testbodysnake[0][5], testbodysnake[0][6], testbodysnake[0][7], testbodysnake[0][8], testbodysnake[0][9], testbodysnake[0][10], testbodysnake[0][11]) [ ( 4 0 0 , 1 6 0 ) ]
 Getting the values from the .txt file <?php $handle = fopen ("testbodysnake.txt", "r"); $testbodysnake = []; while ( !feof($handle)) { $testbodysnake[] = fgets($handle); } fclose($handle); print_r($testbodysnake); ?>
 Getting the Values into the array var testbodysnake = []; var testbodysnake = <?php echo json_encode($testbodysnake); ?>;

¿Alguien sabe cómo puedo solucionar fácilmente este problema y hacer que la matriz lea los números como un todo? Cualquier ayuda sería apreciada

about 4 years ago · Juan Pablo Isaza
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!