Carl-Johan Hagberg Carl-Johan Hagberg - 1 month ago 19
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

$arraycontents
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 = '"http://archive.org/wayback/available?url=' . implode('","http://archive.org/wayback/available?url=',$matches[0]). '"';

$urls = array($arraycontents);


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

Answer

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

$urls = array_map(function($m) { 
   return 'http://archive.org/wayback/available?url='.$m;
},$matches[0]);