php

How to read comment blocks in PHP?

I'm doing some home-brewed automated documentation, since I have a codebase which is not very standard in its layout, and I was wondering what the best way was to read a PHP file and grab the contents of a comment block. The only way I can think to do it is to open the file and read it line-by-line, but thought that maybe there was some ...

how save object to arraylist like C# in php

how save object to arraylist like C# in php ...

PHP Fatal error: Cannot redeclare class

Any one know what to cause this problem?? PHP Fatal error: Cannot redeclare class ...

How to double all line breaks?

Edit: The problem described below was just caused by a "feature" of my IDE, so there's actually nothing wrong with the regex. If you're interested in how to double line breaks, here's your question and answer in one neat package. :) I want to change every line break in a string to be two line breaks: "this is an example string" // ...

php arrays. How to format for my result

I am pretty new to php and could sure use some help understanding how to get my result the way I need it from a database query. What I need is an associative array like this, 'bla'=>'bla'. What I am getting from my foreach loop is this from a print: [0] => Array ( [0] => test0 [name] => test0 [1] => 1 ...

PHP Addslashes adding double backslashes when escaping a single quote

Addslashes seems to be a bit confused. Given the following 2 lines of code $name = "Dave's test"; $newName = addslashes($name); I am expecting $newName to be "Dave\'s test" (my one single quote nicely escaped) However, what I'm getting is "Dave\\'s test" (note the DOUBLE backslashes). This contradicts every bit of online documentat...

can php code break down shared hosting services for the particular IP ?

Sorry, i had to put the same post again due to still no solution I have a strange problem, i just installed my php web site on a shared hosting(php,apache,mysql,linux), all services were working fine. But after configuring my app i just could visit my web site only once, other attempts gives "The server is taking too long to respond.". ...

Can I include a function inside of another function (PHP)?

Is it possible to include one function inside another? To learn functions, I'm trying to create a combat sequence using PHP. The sequence would look like this: Dice would roll, assigning numbers to variables; Hero1 attack results are printed; Dice would roll, assigning numbers to variables; Hereo2 attack results are printed; Dice woul...

PHP APC and Imagick with cpanel

I currently purchased a dedicated server hosted at iWeb and got it administered by them. I recently asked after registration to add php_apc and php_imagick to the available libraries. It seems according to them that it is not possible as it is not supported with cPanel. I would apparently need to do that myself... is there any risks to...

Sending mail through PHP

I'm trying to sends mails in PHP. The code I used for sending a mail in CakePHP is given below. I get the message 'Simple Email Sent' in my web page but the mail is not delivered to my inbox. Am I missing something? The values in the to, subject and link fields are set with the values entered in the user interface. $this->set('to'...

Migrating a large classic ASP page to php?

We've got a large classic asp application and we consider migrating to either asp.net or php. I don't want to talk about the pros and cons of either one, but I'd rather like to know whether there are ways to avoid a complete rewrite in one shot when migrating to php. We simply can't stop maintaining the current codebase just to do a rewr...

Trimming a block of text to the nearest word when a certain character limit is reached?

Here is the question: How would your trim a block of text to the nearest word when a certain amount of characters have past. I'm not trying to limit a certain number words or letters, but limit the letters and cut it off at the nearest word. Say I had two strings: "This is a block of text, blah blah blah" "this is another block of txt ...

C# mapping php params

I have a string that contains ?action=a&current=b&something=c i want to create a variable that i can do val = mymap['current']; Is there something in C# to parse this? or do i need to use a string.split and write my own func? -edit- solved thanks to REA_ANDREW and Guy Starbuck (from the other thread). using System.Web; using System.Col...

Infinite PHP Look in Xampp

If I do an infinite loop or a loop so big it's going to take days, will the process stop if I restart xampp? I coded something which made requests to Google and me and other people on the network started getting the search captcha. I stopped xampp and it seemed to stop but when I restarted xampp it started happening again. It was hard ...

Getting Serial Number of the Hard Drive Provided by the manufacturer through PHP

Getting Serial Number of the Hard Drive Provided by the manufacturer through PHP : How can it be done? I want to store it in a file. OS : windows 2000,XP,ME,Vista... Yes, I want the serial number of the hard drive of the Server. Or can it be done through Adobe AIR? Or can it be done through a C program on Windows? C:\Documents and ...

Ajax messing up Norwegian characters

I'm trying to take the values from a <textarea> and pass it via XMLHttpRequest to a PHP page that adds the content to a database. However, when it reaches the database, the "å æ ø" characters are converted to "Ã¥ æ Ã". I've searched high and low and tried to change to UTF-8, tried to use JavaScript versions of htmlentities()/htmlsp...

Time Zones

I know this isn't specific to PHP, but what's the point of using timezones listed like this :http://us2.php.net/manual/en/timezones.america.php? For example "America/Indianapolis" and "America/New_York". What is the problem with EST, EDT, CST, CDT, &c? ...

Why can't I change the display status using CSS?

I am trying to display a banner on a report while printing but it doesn't print. What I did was I set the display status to display:none in my regular CSS #transfer_head2 { display:none; } and I changed the display status to display:block in my print CSS #transfer_head2 { display:block; } but this is not working. Why? Can anybody h...

PHP coding competition

I would like to know if there are any competitions like Sharp Coder for C and Java which are organized for PHP. Does anyone know where I can find some tasks in which to compete? ...

What is the simplest way to add Facebook Connect to a PHP web site?

Facebook Connect I have spent a few weeks putting together a basic web site which uses Facebook connect as authentication. I have studied 'theRunAround', the provided example application. However the code is convoluted and uses a large number of files and classes, most of which have a lot of functionality that I have no need for. I hav...