1

I am trying debug a custom rule I am creating. In my helper function I am calling an array I want to work with. I want to dpm the contents of the array so that I can see what is available, but it is not working. To check that there wasn't a problem with my array. I set up a new one inside the helper function.

$array = [
      "foo" => "bar",
      "bar" => "foo",
  ];

and then try to dpm the array:

dpm ("array: " . $array);

but all that is shown in the status message is:

array: Array

I have been trying other methods of printing the array like print_r but haven't had any success with these either. How should I be printing my array?

0

1 Answer 1

1

You can only have a string (not an array) as the second argument to dpm().

Try:

dpm($array, "array: ");
2
  • Thanks. I had been banging my head against the wall over that! Apr 11, 2016 at 13:02
  • I would advise using xdebug to debug this sort of thing - it will really save you the headache of trying to debug custom rules.
    – Kevin
    Apr 11, 2016 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.