php

Compare 5000 strings with PHP Levenshtein

I have 5000, sometimes more, street address strings in an array. I'd like to compare them all with levenshtein to find similar matches. How can I do this without looping through all 5000 and comparing them directly with every other 4999? Edit: I am also interested in alternate methods if anyone has suggestions. The overall goal is to fi...

Which license Should I Choose?

Hello, I have been developing my own PHP MVC framework. I want to make it open-source. Basically, I am having bit of problem in choosing the right open-source license. I just want that anyone using/modifying/extending my framework just puts the copyright info intact, that is it. For this, which open-source license should I choose. Th...

How to convert HTML to PDF using PHP ?

Hi All, I want to convert HTML with Google Charts reports to PDF,I used fpdf and other classes but I didnt get success. please help me . ...

Howto create a Calendar in Php?

How can i create a calendar in PHP? Today should be in bold. How could it be coded? ...

Integratiing Zend Framework and Geeklog

Hey, We have a geeklog managed site running at http://bhaa.ie We recently setup a zend application on a subdomain that manages this page http://bhaa.ie/members/public/index.php/event/list We're hoping to better integrate the two domain, so that we can call this url http://bhaa.ie/event/list and have zend handle the request, while ...

php template engine using %%variable%%

I'm looking at the PHP code for the interspire shopping cart and they make extensive use of template variables such as %%GLOBAL_variables%% and %%variable%%. I haven't seen those before and I'm trying to understand how they are defined and used. Does anyone know what template engine is involved and any documentation on it? thanks ...

Is it OK to run the WHILE loops in MySQL?

Is it ok to a mysql query inside a while loop using the ID of each row passed to fetch results from another table? OR is there a better way to do it? $q = $__FROG_CONN__->query("SELECT cms_page.id, cms_page.title, cms_page.slug, cms_page_part.* FROM cms_page LEFT JOIN cms_page_part ON cms_page_part.page_id=cms_page.id WHERE cms_page.pa...

A little php help with this string formatting...

I have a string in this format: /SV/temp_images/766321929_2.jpg Is there any small piece of code to get the numbers BEFORE the underscore, BUT AFTER temp_images/? In this case I want to get 766321929 only... ? Thanks ...

Php Pager question

I am using the pager class (from pear) in PHP. I am not sure if I am using it right, but I downloaded some code from Internet where I can include a pager class and call the pager function.. This is how I am calling the Pager function in my php page... require_once('pager/Pager.php'); $pager_options = array( 'mode' => 'Sli...

PHP: an example where allow_url_include is a good idea?

I just noticed a PHP config parameter called allow_url_include, which allows you to include a PHP file hosted elsewhere as you would a locally. This seems like a bad idea, but "why is this bad" is too easy a question. So, my question: When would this actually be a good option? When it would actually be the best solution to some proble...

How to make a clickable header in wordpress?

How do you make a Wordpress header image clickable so that it navigates to the the home page. Here is my header.php file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head profile...

Does PHP's date() function return the date and time on the server or on the client's computer?

Does PHP's date() function return the date and time on the server or on the client's computer? ...

Zend Framework URI space encoding in PHP and Javascript

I've a Zend Framework URI like /controller/action/var1/value1/var2/value2 . Value2 has a space character in it. How should I encode it in PHP? When I use urlencode with value2, this converts space into '+' instead of '%20f'. Is that ok? This value2 is also added to a href location by javascript on client side. I'm using escape functio...

Create a RESTful url for a php script

Hello, I have a php script on a webserver. Currently, the script is being accessed as http://www.mydomain.com/scriptname.php . Is there a way i can create a user friendly url for accessing this script, something like http://www.mydomain.com/appname, so when this url is called it invokes the php script ? Please help. Thank You ...

Caching strategy for merged MO files, which become arrays?

To clarify: I'm not using the gettext php module/extension, reason being because I have to deal with servers that don't have gettext included, I'm aware of php-gettext but that just complicates things in that I have to use multiple libraries. Further more I don't want to depend on the user having the necessary locales installed, and so...

Get value from remote page and store as local variable.

I have a page on a remote server that returns a single xml value <?xml version="1.0" ?><Tracker>12345</Tracker> How do I go about getting the value 12345 or whatever is in the tag into a PHP variable? I know I can't do something as simple as: <?php $var = http://www.www.com/file.php; echo $var; //12345 ?> I'm new to the ...

PHP Inbox Function

I received some great help on my last question. Here is where I'm at: I'm on the very last step of building a threaded messaging system for a dating website project for school and want to highlight a with a different bg color when a message is new. This is the table structure: CREATE TABLE `messages` ( `id` bigint (20) NOT NULL A...

$img_attributes style question

Can somebody explain me why the small piece of code doesn't work? This is the error what is given: Parse error: syntax error, unexpected '=' in /var/www/g35003/ $img_attributes= style='max-height: 100px; max-width: 100px' . 'alt="'.$product['product_name'].'"'; ...

What difference does it makes when I use '' against "" ?

What difference does it makes when I use '' against "" ? For example: $example = 'Merry Christmas in Advance'; $eg = "Merry Christmas"; echo "$example"; echo '$example'; echo "$eg"; echo '$eg'; What would the output for each echo statements and what can we infer about '' vs "" in PHP ? ...

Getting the overall return value of a function within a loop

What I am doing is looping over an array and running a function on each value of the array (the function returns true on success, false on error). I would like to return false if any of the calls inside the loop returned false, but I want the whole loop to be processed. Probably easier to explain with code: foreach($this->_cacheLocatio...