![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() |
Urgent PHP Help Please!
I've been doing a small business project for someone in Python, that involves general data manipulation. But now he tells me he wanted it in PHP. So practically all I have to do is translate all the python scripting into php, because he wanted this program to run everytime the php script is accessed.
Could you please give me a quick few links, that aren't related to web programming, but moreso things I will need to convert Python to PHP? Help please quick, before he fires me! :p The contents of the Python program involve, - list manipulation, and nested lists - random choices - reading html from websites - string indexing - saving to text files |
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
http://www.php.net/ -- I'm sure you already have it, but it's the best resource for PHP scripting...
If you want to split up what you're getting paid, I wouldn't mind converting it... ![]()
__________________
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() |
yeah I do, but I assume that's mostly info about how to incorporate php into your websites. I updated the first post on what sort of PHP commands I need.
And it's a nice offer, but I'd like to learn what I can when it comes around. ![]() DAMNIIIIIIIT. Someone else jumped in and finished up the script before I could. That was over quick .............. ![]() |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Presuming you have an idea in your mind what your Python actually does, just view it as pseudo-code and translate it into PHP. The PHP manual is one of the best sets of documentation extant -- decide what functions you need and search for them. Even if you don't get the function name right, you generally get some valid suggestions/links. If that fails, refer to the contents for the appropriate subject matter.
It may be (I don't know) that Python does so much for you under the hood that, not knowing how to do it yourself, you're up a creek without a library oar. Perils of dependency in the pursuit of RAD. PHP certainly won't kill yer butt in that area like having to shift to, say, C/C++ would, though.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 | |
|
Programming Guru
![]() |
Quote:
[* Associative arrays are supported by default in PHP arrays] 2) int rand ( [int min, int max] ) 3) ... [php] function readWebpageContent($url) { return implode("", file($url)); // If you are using PHP5 the following will work as well... // return get_file_contents($url); } [/php] 4) String Functions [* Most common/useful: strlen() substr() str_replace() implode() explode() preg_replace() ] 5) ... (more info) [php] function fileSave($file, $data) { if(file_exists($file) && is_writable($file)) { $file = fopen($file, "wb"); fwrite($file, $data); fclose($file); } else { die("{$file}: Cannot be opened or is not writable...<br />\r\n"); } } [/php]
__________________
|
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() |
Okay, I figure I'll learn PHP anyways. Due to the overwhelming job demands, I'm bound to make some easy cash and learn well this way. And I hate making websites, and it sounds like poop. Maybe this can convince me other wise.
I'll start tomorrow. *trashes C#* Wow, thanks for the start tempest! ![]() |
|
|
|
|
|
#7 |
|
Expert Programmer
|
DAMNIIIIIIIT. Someone else jumped in and finished up the script before I could. That was over quick .............. Unlucky ![]()
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|