php5

Optimizing Trie implementation

For no reason other than fun I implemented a Trie today. At the moment it supports add() and search(), remove() should also be implemented but I think that's fairly straight forward. It is fully functional, but filling the Trie with data takes a little too much for my taste. I'm using this list as datasource: http://www.isc.ro/lists/twl...

Form with file input field wierdness

Ok. I'm probably just to tired to spot an issue here. The problem is when I submit this form, the attached file does not get submitted. $_FILES array in PHP is always empty. Here is HTML form: <form enctype="multipart/form-data" method="post" action="navigator.php?kam=editovatElearningKurz&id=-13"> <dl> <dt> <label for="docume...

custom Php Function Needed which takes the date in the Format of MMDDYYYY as a variable and it should return YYYYMMDD

custom Php Function Needed which takes the date in the Format of MMDDYYYY as a variable and it should return YYYYMMDD ...

How to print to pdf using php with a canvas element

I'm trying to make an on-the-fly PDF generator using PHP, but I'm having one problem so far in that the pages I am trying to generate as a PDF have a bar graph generated by flot using a canvas. Does anyone have experience with this or know how to get canvas to print to pdf? I'm also open to the idea of simply having my client load a p...

Reading in 738627 records via flat file gives memory exhaustion error

I am trying to read in a simple flat file, it has 738,627 records in it, a sample of the file looks like this: #export_dategenre_idapplication_idis_primary #primaryKey:genre_idapplication_id #dbTypes:BIGINTINTEGERINTEGERBOOLEAN #exportMode:FULL 127667880285760002817317350 127667880285760002818261461 127667880285760002825372301 127667880...

Why does using an If statement change a variable?

I am reading a text file and processing some records, a relevant sample of the text file is #export_dategenre_idapplication_idis_primary #primaryKey:genre_idapplication_id #dbTypes:BIGINTINTEGERINTEGERBOOLEAN #exportMode:FULL 127667880285760063715151750 127667880285760123715151751 I want to perform a specific action when application_i...

Regular Expressions to get text between tags

I am writing an application to get the title of an html page, some text under the body tag and an image. It is something like the share stuff of facebook. I can get a regular expression that does that. Thanks for your assitance. ...

How to build multi oop functions in PHP5

I have a question about OOP in PHP5. I have seen more and more code written like this: $object->function()->first(array('str','str','str'))->second(array(1,2,3,4,5)); But I don't know how to create this method. I hope somebody can help me here, :0) thanks a lot. ...

Multidimensional Array based Elements

Using Zend_Form, how would I create form elements like this <input type="text" name="element[1]" value=""/> <input type="text" name="element[2]" value=""/> ...

Getting a 2GB file inside PHP?

I am needing to download a very large file via PHP, the last time I did it manually via http it was 2.2gb in size and took a few hours to download. I would like to automate the download somehow. Previously I have used file_put_contents($filename, file_get_contents($url)); Will this be ok for such a large file? I will want to untar th...

PHP script not decoding URL parameters in $_REQUEST[] (%20 values present) after deploying to 5.2.4

I have developed a PHP script that uses $_REQUEST[] superglobal. A typical client request might consist of: http://host.name/socnet/add.php?shortid=1&amp;author=NewUser2&amp;comment=Dad%20dad%20dad This URL is rewritten by Apache in my production environment to an equivalent https:// URL according to the following rewrite rule: Rew...

PHP5, SOAP and 64 bit Debian machine

Hi. I've recently updated the versions of PHP5 and Apache2 on 2 debian machines. I have SOAP services on them both (they're both behind a load balancer), and on one they work, the other they don't. The one that doesn't work is a 64 bit machine. I'm using PEAR SOAP and wondered if anyone had seen any issues like it or knew of any work a...

building a plugin using Piwik (integrating json with piwik)

I want to build a plugin for piwik which can plot graphs by reading a json file. I want to bypass the whole process of having to acess a mysql database, is there an easy way that I could achieve this. Also I want to build a UI with standard things such as checkboxes, textfields etc, can I do that using piwik ...

Add Entry to DB, Upon Success Refresh Messages

Hi all, So it's not a complicated matter at all, but was wondering how the Stackoverflow community would tackle this. I wrote a facebook-style wall type thing where users enter their "status", it gets processed via jQuery Post and upon success returns a success message. Prepending the new message to the Wall Stream would make sense, ...

How to speed up processing a huge text file?

I have an 800mb text file with 18,990,870 lines in it (each line is a record) that I need to pick out certain records, and if there is a match write them into a database. It is taking an age to work through them, so I wondered if there was a way to do it any quicker? My PHP is reading a line at a time as follows: $fp2 = fopen('do...

Drupal 6 Redirect automatically when selecting deepest item from a hierarchycal tree

Drupal 6, Redirect automatically when selecting deepest item from a hierarchycal tree, like: Tree Parent .|Child 1 ....|_Child 1.1 .|_Child 2 Redirect action must occour only on the last items: Child 1.1 and Child 2 Destination of creat different content types, will be defined in js array. But how to send hierarchical selec...

Why is (If false return "true") ... returning true?

Inside the begining of a function I have this: if(false); { return 'TRUE'; } it is returning "TRUE"! Obviously my real use was checking a more useful expression and returning something else. I just changed it to this to elaborate my point. Why is this happening? Can you not put a return inside an if statement? I do this all the t...

Problem with array_key_exists

Hey there, I'm implementing some affiliate tracking to my site. The affiliate network has asked that I hide the telephone number on the site. When an affiliate clicks on a link to my site, any of the site URLs will be appended wth something like /?source=affiliate&siteid=XXXX for example; mydomain.com/?source=affiliate&siteid=XXXX I'v...

how to get user id of a facebook user in a facebook iframe application?

I'm developing a Facebook iframe/Facebook Connect application with PHP client library. In my index page, I check if the user is logged in by using require_login(). $user_id = $facebook->require_login($required_permissions = 'user_location,publish_stream,email,read_stream,user_about_me,user_activities,user_birthday,user_events,user_grou...

PHP String Function

Simply put, I have a string with a prefix "msg" followed by some numbers that serve as the ID for a list item e.g. <li id="msg1"></li>..............<li id="msg1234567890"></li> What is the most efficient way to grab just the numbers? In VB, I'd do the following: str = "msg1" str = right(str,len(str)-3) How would I do something ...