php

Visualise OO PHP code

Hello, Does something exist that I can point to my PHP project and it can look at all the files (or just the ones that I specify) and generate a diagram based on the objects and function calls? It would be a good way to verify that my design is actually being implimented :) Background: I'm trying to build a PHP website using OO princip...

Performance of Empty Functions in PHP

What are the 'costs' involved in calling an empty PHP function? The main purpose is for a CMS to trigger included module events at various points in its lifespan to handle things like security, access permissions, post processing, timing, http(s) and the like. Since there can be over a dozen modules called dozens of times each the tota...

Convert a delphi TColor with PHP

I have some colors that seem to come from a Delphi TColor variable (e.g 8388608, 128, 12632256). I need to convert those colors to their rgb values with a PHP script. How can this be done in PHP? ...

Remove line breaks and new lines from PHP variable value?

I have a PHP script that does the following: Uses file_get_contents() to get content of html file Echos a JSON object The issue is that the value obtained from file_get_contents is multi line. It needs to be all on one line in order to be in correct JSON format. For example PHP File: $some_json_value = file_get_contents("some_htm...

Why does flock occasionally take a long time on Windows / NTFS?

I use the file system to create a application wide persistent singleton (application does not use a database). Occasionally a page will take 1-2 minutes to load and I have narrowed the problem down to the use of flock in the function that gets an instance of the singleton. Here is a simplified version of the code: (edit: left out the m...

Capture Progress From Command Line

Hello all, % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 12.4M 100 12.4M 0 0 4489k 0 0:00:02 0:00:02 --:--:-- 4653k The above is a CURL output from the command line when download the file. I have captured...

Preg_Match a string in the form of a URL

I have a URL as a string. How do I match the numbers after the VideoID. Also VideoID may occur at different points in the URL. But I will worry about that afterwards, as I can't even do this. $string = 'http://example.com/index.php?action=vids.individual&amp;VideoID=60085484'; preg_match('/(?<VideoID>)=/', $string, $matches); print_r(...

How can I split a comma delimited string into an array in PHP?

I need to split my string input into an array at the commas. How can I go about accomplishing this? Input: 9,[email protected],8 ...

What is the alternative to MVC and an ORM?

In the context of RoR and multiple disperate database connection, I was given this comment. What is my alternative on an Apache server (mac)? PHP, no MVC, and a mess? Also, this is not a comment about PHP. It just allows the classic asp mess that I have now, but fwiw, the "mess" works and has served well for many years. I wanted to ...

Deleting multiple items in PHP

I have a list of items need to be passed which should be deleted. How can I do this in PHP? $query = "DELETE from members WHERE member_id ='$chan[2]' "; $chan[2] holds multiple values, but deletes only one. ...

reading option of three select tags with same name

Hello How can i have three or more select tags with same names(as in my program, the select tags are being generated dynamically), and select independently what option was selected. I have a loop, where my php reads a sql table, and for each row, it creats a select tag and a button with it. <select name="vote"> <option value="1">...

Is it possible to have a peer to peer communication using nothing but PHP

Is it possible to implement a p2p using just PHP? Without Flash or Java and obviously without installing some sort of agent/client on one's computer. so even though it might not be "true" p2p, but it'd use server to establish connection of some sort, but rest of communication must be done using p2p i apologize for little miscommunicati...

Deleting related records in MySQL

I have two MySQL (MyISAM) tables: Posts: PostID(primary key), post_text, post_date, etc. Comments: CommentID(primary key), comment_text, comment_date, etc. I want to delete all the comments in the "Comments" table belonging to a particular post, when the corresponding post record is deleted from the "Posts" table. I know this can ...

Getting the ID's of all selected field in php

When i select multiple checkbox, i get the values something like this.... 9,[email protected],1,9,[email protected],2,2,[email protected],3,2,[email protected],4 Now i need to delete all of them, so i need to pass their user ID alone to query. For this i need to split the string and pass their multiple ID's alone to query. $var1 = $theArrayValu...

open a new html page through php.

Hello, I want my php to open a new html page. I have a html page, where a member can login by typing her username and password and then click on button. if the username password is correct, i want my php to open a different html page in the same window. how can i do this?? Zeeshan ...

Using parent variables in extending class

Hi, I have three classes MainClass, Member, and Project. Member and Project extend the MainClass. First I create a MainClass object, then a Member object and execute the function setMember: $mainclass = new MainClass(); $member = new Member($id); $mainclass->setMember($member); When the $member variable is set to the current member ...

Question with XML construction using PHP

Hey everyone, Currently, I am constructing an XML document in PHP that will yield the following: <root> <collection> <region>1</region> <primary>John</primary> <collection> <collection> <region>1</region> <primary>Jane</primary> <collection> <collection> <region>2</region> <primary>Jill</primary> <co...

"pushing" code to javascript from php

Hi, I currently have a piece of jquery/js code that runs every few seconds (5) a GET request, looking for new data that might of come in. Is there some way I could get PHP to "push" or signal to the javascript code when new posts are available, rather then checking every few seconds if anything new came in? Another example: I'm resizin...

How to display XML data (extracted from PHP) in an Adobe Air Application ?

Hello I would like to create a small Adobe Air application which would extract XML data from my site and display it in my Adobe air application. I have the xml part setup, when i run the xml file, it displays the results in the browser. Now what i need is to display the same results in my adobe air application. For e.g. I have a simpl...

How can I indicate that a parameter in a php function has a type of determined class using the phpDoc?

In this example: /** * * @param <type> $foo * @return <type> */ function do_something($foo) { return $foo->really_do_something(); } How to indicate that $foo must be of the class Foo? ...