0

How can I disable the Array text? Everything works fine, but the Array text of var_dump or at least print_r is not what I want.

array(1) { [0]=> string(21564) "Content" } 

This is my code:

<?php

$url = "http://competitive.euw.leagueoflegends.com/de/ladders/euw/current/ranked_team_3x3";

preg_match('#<table class="views-table cols-6"[^>]+>[\w\W]*?</table>#i', file_get_contents($url), $match);
print_r($match);

?>

Array ( [0] => ) <--- This is the ugly part on it which has to be deleted

Life example to show the problem: http://bruteforce.tv/index.php/ladder

4
  • Add the language, please, or nobody will know what you need. I assume this is PHP? Commented Jan 27, 2013 at 12:17
  • What exactly is your problem? Commented Jan 27, 2013 at 12:38
  • What do you mean "disable the array text"? You want to disable the native functionality of PHP? Commented Jan 27, 2013 at 12:38
  • bruteforce.tv/index.php/ladder Commented Jan 27, 2013 at 13:47

2 Answers 2

1

You can use var_export it outputs a valid PHP representation of your variable, if thats what you are after?

Edit: OP wanted to output the result of the preg_match rather than debug it, echo $match[0] was the answer...

Sign up to request clarification or add additional context in comments.

4 Comments

Now its array ( 0 => '', ) instead of Array ( [0] => ), doesnt help :<
Your not just seeing array(0 => the first item in that array is your table html markup
If what you want to do is output the table onto your webpage, then you need to do echo $match[0]
Do you know how to replace some content with <span class="brc">content</span>?
0

Be more specific on what you call array text. If you're talking about the String(5) part then you can just use print_r instead of var_dump otherwise, there's no reason to use either of those functions.

If print_r and var_dump behaviors are the same on your system it must be a PHP plug-in that's modifying the outputs - probably XDebug

2 Comments

Im using a Joomla extension called Jumi
Maybe it helps when you see a life example: bruteforce.tv/index.php/ladder

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.