PHP has a var_dump() function which outputs the internal contents of an object, showing an object's type and content.
For example:
class Person {
private $firstName;
private $lastName;
public function __construct($firstName, $lastName) {
$this->firstName = $firstName;
$this->lastName = $lastName;
}
}
$person = new Per...
I need to perform a HTTP GET from PHP.
More specifically, from within /index.php I need to get the content of /trac/ and /svn/, find the "ul" element and then render then inline on the index.php.
/trac and /svn are relative URLs and not filesystem folders.
http://myserver/trac and http://myserver/svn
...
I would like to replace ">" with ">" and "<" with "<" but only when they occur outside "<pre>" and "</pre>". Is this possible?
$newText = preg_replace('>', '>', $text);
I would be using the preg_replace in PHP as above.
...
Edit: This behaviour is reproducible with query globals on.
I have the following:
$_SESSION['query_key'] = $_GET['query_key'];
print($query_key);
Vs.
$_SESSION['query_key'] = clone $_GET['query_key'];
print($query_key);
The former prints out the value of $query_key, while the latter prints nothing.
What sort of weird side ...
Hello,
I am using the following html page:
<html>
<head>
<title>AJAX Example</title>
<meta http-equiv="Content-Type" content="text/html"; charset="iso-8859-1">
</head>
<script language="JavaScript" src="ajaxlib.js"></script>
<!--define the ajax javascript library-->
<body>
Click this <a href="#" OnClick="GetEmployee()">link</a>...
I have the following in a page e.g. /mypage?myvar=oldvalue
$_SESSION['myvar'] = $_GET['myvar'];
$myvar = 'a_new_string'
Now $_SESSION['myvar'] has the value 'a_new_string'
Is this by design?
How can I copy the value of 'myvar' rather than a reference to it?
...
"Fatal error: Allowed memory size of 31457280 bytes exhausted (tried to allocate 9828 bytes)".
This is the error i get but I am only trying to upload a 1mb image. I have increased the memory limit in php.ini and the execution time. I am trying this on a local MAMP server, on a Mac using firefox. This going to be for an online image gall...
I have a PHP-generated page which is displaying some data about a set of films. The page is updated using POST. The form only shows films starting with a particular letter. I want to present a set of clickable options at the top of the screen, each of which is a letter. So if you click on "B" it submits the form and re-draws the page sho...
I have this code:
<?php
session_start();
$cmd=$_GET["cmd"];
$con = mysql_connect("localhost","root","geheim");
if(!con)
{
die('Connection failed because of' .mysql_error());
}
mysql_select_db("ebay",$con);
if($cmd=="GetEmployee")
{
sleep(10);
echo "<table border='1' width='100%'>
<tr>
<th>test1</th>
<th>test2</th>
<th>test3</th>
</tr>";...
I'm using Drupal 5 and have a multitude of views that I want to alter the output of. Using the views wizard, I can create a different template for each instance, but I'm wanting to do the same changes across all my views and having 30 files in the themes directory seams like a hell of a lot of maintenance and code. Does anyone know if ...
I would like to use "ON DUPLICATE KEY UPDATE" in Zend Framework, is this possible?
Example
INSERT INTO sometable (...)
VALUES (...)
ON DUPLICATE KEY UPDATE ...
...
Given the following sample array, how can I find all permutations of times available such that the amountNeeded is satisfied? In others words the follow array should produce the following:
Available on 2008-05-14 from 08:00 to 08:10 using resource 10 and 13
Available on 2008-05-14 from 08:10 to 08:20 using resource 10 and 13
pri...
...I have read a few threads on here that have discussed various methods and was just looking for some feedback on a proposed solution we came up with. In one of the threads a comment was posted recommending a public/private key which sounded great, this is what we were thinking...
Client Side -
1. Key is stored inside of Flash swf whi...
In through php_info() where the wsdl cache is held (/tmp), but I don't necessarily know if it is safe to delete all files starting with wsdl.
Yes, I should be able to just delete everything from /tmp, but I don't know what else this could effect if I delete any all wsdl files.
...
I would like to search my table having a column of first names and a column of last names. I currently accept a search term from a field and compare it against both columns, one at a time with
select * from table where first_name like '%$search_term%' or
last_name like '%$search_term%';
This works fine with single word sear...
I'm building a fairly simple php script that will need to send some emails with attachments. I've found these 2 libraries to do this. Does either one have significant advantages over the other? Or should I just pick one at random and be done with it?
...
So the chain of events is:
The user submits a form.
During the processing of the submission, there is a message generated, such as "Your record was saved."
The user is redirected to a new page, say the search results.
The new page needs to display the message.
So, the question is how to get the message from step 2 to step 3? This is ...
I have a webapp from which I'd like to insert diagrams and images quickly and easily. I expect there is, somewhere out there, a webservice which will take a URL with a parameter that describes the vector graphics or diagram and returns an image.
No unlike what google charts does for graphing data.
Any resources or ideas on this?
If I...
I've been contacted to see about updating an old legacy web application that was built using ASP and Access. The server is running Windows 2000 Advanced Server and I believe IIS 5.0 (I am trying to get confirmation on that, but the company isn't technical so I highly doubt Apache is running on the server).
What languages would be viable...
<?php
class foo
{
//this class is always etended, and has some other methods that do utility work
//and are never overrided
public function init()
{
//what do to here to call bar->doSomething or baz->doSomething
//depending on what class is actually instantiated?
}
function doSomething()
{
//...