1

My PHP file is storing input in the form of an array from HTML checkbox. I need to pass this array to a python file. There are few answers already that discuss it here and here

They all involve use of JSON as it can serialize data.

However I wanted to know if there is some other way to achieve it, for example where I can pass it like integer or string variables like:$output=shell_exec("python.py $var1 $var2 $arr1);

If I directly pass the array as above. The data sent is literally Array.

So any way to achieve this.

For python , I am reading all arguments as :arg=sys.argv() var1 = arg[1] var2=arg[2]

john
  • 335
  • 3
  • 12
  • Is there something about the JSON solution you don't like? It will help anyone who answers to know why you don't want to use that solution. – FamousJameous Jun 16 '17 at 18:12
  • Yes, I am passing other variables directly through the command line. I want to maintain a consistent way of passing data rather than use different methods for different data structures – john Jun 16 '17 at 18:17

0 Answers0