Carl-Johan Hagberg Carl-Johan Hagberg - 1 year ago 88
PHP Question

Array content, stored in variable, gets cut off

I am trying to put content into an array. The content, around 100 urls, is already stored in a variable that I call

which is formatted with ",". For some reason the array get cuts of when I do this but it works when I put in the urls manually. Very annoying problem.

Here is the code:

$arraycontents = '"' . implode('","',$matches[0]). '"';

$urls = array($arraycontents);

in the error message I get it looks like the array is cut off.

Answer Source

$matches[0] contains "urls" already an array, so prefix all with (if I guess right what OP wants)

$urls = array_map(function($m) { 
   return ''.$m;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download