php

what are the differences in die() and exit() in PHP?

what are the differences in die() and exit() function in php, I think both have the same functionality. But i know there is something different in both.. what are they? ...

Ideal Folder Structure of MVC framework

Hello guys, I would like to ask what is the ideal folder structure for a MVC framework that should be able to support multiple installations. For example, I install xyz framework and i run two or more sites based on this single installation of xyz framework rather than installing the framework for each site. This is probably done in Co...

PHP options for extracting data from an array?

Given this two-dimensional array, each element has two indexes – row and column. <?php $shop = array( array("rose", 1.25 , 15), array("daisy", 0.75 , 25), array("orchid", 1.15 , 7) ); ?> Are these my only two options for extracting the data from the array, using row and column indexes? <?...

How to link PHP library help to NetBeans ?

Hello, How can I get NetBeans to automatically detect and show help for the core PHP functions ? Thanks ! ...

PHP: Characteristics of MVC framework

Hello All, For the one who is thinking of developing a MVC framework, it is important that he understands what it actually is. So my questions is what are the characteristics of a PHP MVC framework? ...

jQuery Ajax on Different Port

Hello, My php file located at port 80 (default port) while my ajax call are on port 8080. My index.html on port 8080 $(document).ready(function(){ $.get("userCheck.php", {"username" : "lazy", "favcolor" : "FFFFFF" }, function(data){ alert("Data Loaded: " + data); }); My PHP $user = $_GET["username"]; if($...

Help with algorithm to determine phrase occurrence in string in PHP

I have an array of phrases (max 2 words) like $words = array('barack obama', 'chicago', 'united states'); and then I have a string like: $sentence = "Barack Obama is from Chicago. Barack Obama's favorite food it pizza."; I want to find/create an efficient algorithm that would return the number of occurrences of the words in the arr...

Sorting a multidimensional array in PHP?

I have this kind of an array array(5) { [0]=> array(5) { [0]=> string(7) "jannala" [1]=> string(10) "2009-11-16" [2]=> string(29) " <p>Jotain mukavaa.</p> " [3]=> int(12) [4]=> int(1270929600) } [1]=> array(5) { [0]=> string(7) "jannala" [1]=> string(10) "2009-...

IIS: Setting a script map on "Web Sites" node

Regarding setting up script maps on IIS, I am wondering what happens if I create a script map for .php files to C:\php\php.exe on the Web Sites node. Do all websites below the web Sites node, including the Default Website inherit the setting or do I manually have to add the script map to all 29 websites below the Web Sites node. ...

Can I Set The Value Of A Text Input Field Using A Variable?

Hi, I am having one form. I am submitting the values to database of table test fields something .I want to fetch those existing values to text field so that I can edit and update again. I am using below code but I am not getting valid output. Can anyone help thanks in advance. //these values iam passing from one form $bre=$_POST['bf'...

CakePHP: reusing models, controllers, configuration but not views and routes

Hi guys, Our website is going to work as follows: There's a central site www.example.org where everybody can register, change information, manage their 'business card'. Also, everybody will have companyname.example.org. Here users can publish a simple site based on information they change in the main site. This site is being built o...

Multiple requests on PHP

I have an application on an Apache2. The applications plays some media files like video files, mp3 files and wav files using a php file in order to avoid direct download from not-registered users. Now, I'm having problems because during the media file is loading, I cannot go to another page on the application until the media file is full...

Apache/PHP experts? Large file download fails: empty file is saved with zero KB

I have a web page that I use to give authenticated users access to download files. The files are in the root folder (not normally HTTP accessible), and I use a PHP script and the fopen function to generate the web page that starts the download of the files. It works perfectly for three of the files (all of which are under 200KB), but the...

How to get opcodes of PHP?

<?php $show_value = 123; echo 'sing_quote'.$show_value; echo "double_quote{$show_value}"; ?> Its opcode is: 1: <?php 2: $show_value = 123; 0 ASSIGN !0, 123 3: echo 'sing_quote'.$show_value; 1 CONCAT 'sing_quote', !0 =>RES[~1] 2 ECHO ~1 ...

Debug PHP and Control Flow?

I am an autodidact so dont know much about conventional web development however, I have wrote a complete social networking website yet I dont know how to debug. My website has some problems and I need to learn debuggin things around/ First of all I need instructions how to install Xdebug on WAMP (since I use phpDesigner). I tried a lot ...

Using Google's Contacts API's, how can I get the user's name and gmail address?

I know how to get the entire contacts list using Google Contacts API (I get a session token and use Google's Zend package for PHP). But how can I get the person's name and email address? Currently, the Contacts API just seems to give all of the contacts. I'm not sure how to distinguish which email and name out of that list corresponds t...

Format php date with a variable

Hi! I got a code like this that works just fine. $dates[] = date('F, Y', $date); I wonder if it's possible to pass a variable to the first argument. Something like this (but this doesn't work): $date_format = 'F, Y'; $dates[] = date($date_format, $date); EDIT: This actually works just fine. Just placed the variable in the wrong pl...

PHP - recording errors

What is the best way to record errors experienced by the user? My initial thought was to make a function that recorded the error with a unique number and maybe a dump of the variables into a record on the database. Is there a better approach? Should I use a text file log instead? ...

php associative array construct

Is this the proper construct of my wannabe associative array or is there a better method to this? Each ID key is associated with a value, in this case ID is Nickels(index key) with a value of "5", assigned to the variable $money1. $money1['Nickels'] = "5"; $money2['Dimes'] = "10"; $money3['Quarters'] = "25"; ...

How to check if the webpage has actually been loaded?

Hi, I have an affiliate tracking script that is currently being exploited by an affiliate. In the main, site I track the affiliate clicks using this url www.example.com?member=affiliatecode, then I capture the query string $_GET['member']; Problem is, an affiliate is exploiting this simple system and page loads on his site is being reco...