how to convert a string to an array in php

Use explode function

$array = explode(' ', $string);

The first argument is delimiter


try json_decode like so

<?php

   $var = '["SupplierInvoiceReconciliation"]';
   $var = json_decode($var, TRUE);
   print_r($var);
?>

Take a look at the explode function.

<?php
// Example 1
$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
?>

With explode function of php

$array=explode(" ",$str); 

This is a quick example for you http://codepad.org/Pbg4n76i

Tags:

Php