Read and write php arrays with python
Project description
php_whisperer
"I heard you help people with PHP problems?" "Truth is, I help PHP with people problems."
Read PHP
Convert PHP arrays to Python objects using read_php
PHP File:
<?php
# /tmp/a_php_file.php
$data = [
"My Php Array" => [
"You",
"get",
"the",
"point"
]
];
Python Code:
from php_whisperer import read_php
read_php('/tmp/a_php_file.php', variable='data')
Result:
{'My Php Array': ['You', 'get', 'the', 'point']}
Execute Arbitrary PHP
from php_whisperer import read_raw
php_code = """<?php
$v = explode(" ", "You get the point");
"""
data = read_raw(php_code, "v")
print(data)
Write PHP
Convert Python lists and dictionaries to PHP using generate_php
from php_whisperer import generate_php
generate_php([1, 2, 3, 4])
Result:
array(1, 2, 3, 4);
Modern syntax also available:
from php_whisperer import generate_php
generate_php([1, 2, 3, 4], modern=True)
Result:
[1, 2, 3, 4];
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file php_whisperer-3.0.0.tar.gz.
File metadata
- Download URL: php_whisperer-3.0.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db3edf58fde6bef1bdffe649abb589a7a77e1983fe394254c0ddfcc9314dd1a4
|
|
| MD5 |
480be1952b7757821b7d58d5f5b44417
|
|
| BLAKE2b-256 |
06fc595b5b6ef742e80fb1b4fc2a5310c520efae68e09f027bb53a9a19557174
|
File details
Details for the file php_whisperer-3.0.0-py3-none-any.whl.
File metadata
- Download URL: php_whisperer-3.0.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64cf9146e9507e28887776eeb101b609a1cc0b72e322b2f7094f88c4899374e4
|
|
| MD5 |
6d23b46e3f8e050ca350d8763762fa01
|
|
| BLAKE2b-256 |
0826b45435e98a727bfbec5c55fdb2d131147b68e6563e48dc41aeb5058708ca
|