Is there a way I can set up callbacks on (or automataically log) method parameters, entries, and exits without making explicit calls within each method? I basically want to log this information to my logger class (which is static) without having to do it manually for each method.
Right now I have to call Logger::logEntry() and Logger::l...
In Joomla 1.0, the current User object was stored in a global variable called $my. This doesn't exist in Joomla 1.5 any more - how do I get that object? Also, how can you tell if the user hasn't logged in?
...
errr i checked the related questions using different re-phrase(s) of my question but nothing was related enough to my question....
anyway
i have this form with a <textarea> and i wanted to capture any line breaks in that textarea on server-side and replace them with a <br/>
is that possible?
i tried setting the css of the textarea to whi...
Hi,
I'm looking for a PHP extension that allows me to connect, bind/listen, send, and receive data on a TCP socket.
There is a PEAR package Net_Socket:
http://pear.php.net/package/Net_Socket
But this would require PEAR to be installed which we wouldn't want to do as this increases memory consumption.
Is there an available purely C e...
How can I decode a base64 encoded message in PHP?
I know how to use PHP_base64_decode function, but I wanna know how to write little endian part, like the code below, it is base64 code with little endian: (how to write little endian part in php)
Original Base64 Content ( as posted by original poster ) :
http://stackoverflow.com/revisio...
I mean what the most efficient way to get information about the quantity of your page's items and make sql query with LIMIT that you need. or I should get all items and then crop array with php functions?
now I do 2 queries: first to count all items and second to get items that I need with LIMIT.
OK, I'll be more concrete. For exam...
Since MySQL doesn't seem to have any 'boolean' datatype, which datatype do you 'abuse' for storing true/false information in MySQL? Especially in the context of writing and reading from/to a PHP-Script.
Over time I have used and seen several approaches:
tinyint, varchar fields containing the values 0/1,
varchar fields containing the...
I'm just starting to try out phpunit on some existing code. The naming convention we use is that the MyClass class should be in MyClass.class.php. PHPUnit seems to require that the file should be called MyClass.php.
Is there any way around this?
I noticed it while trying to generate a skeleton test class:
phpunit --skeleton-test MyCl...
There is a space of x*y for text to go on $im (GD Image Resource) how can I choose a font size (or write text such that) it does not overflow over that area?
...
I always hear that using "lastInsertId" (or mysql_insert_id() if you're not using PDO) is evil. In case of triggers it obviously is, because it could return something that's totally not the last ID that your INSERT created.
$DB->exec("INSERT INTO example (column1) VALUES ('test')");
// Usually returns your newly created ID.
// However w...
I have a PHP script that processes file uploads. The script tries to organise the files that are uploaded and may create new folders to move the files into if needed. These files will be below the www root directory (ie, a web browser will be able to access them).
My question is, what permissions should I set for the folders that get cr...
The basics have already been answered here. But is there a pre-built PHP lib doing the same as Lingua::Identify from CPAN?
...
I'm looking for a library in PHP that can create a tree structure from a database (or array of values) with left and right ids. For the result when getting values I am only looking for an array so I can create any type of view. For adding and removing, it would be nice if the library did it all. Even if the library is within another libr...
Has anyone ever modified the "post-new.php" file in their WordPress installation?
I want to modify the look of this page to include pieces that I standardly include in my blog posts, and I just don't know if it is do-able/easy/worth my time.
Should I just find another CMS that allows more modifcation like Drupal?
...
I would like to programatically (using php) fill out an existing drupal form to create a content type that is included in a contributed module.
Details: The module is SimpleFeed and the content type is Feed. I would like to call the module's functions to accomplish this. The method I am interested in is hook_insert which appears to requ...
Sounds like a weird question, but say I have something like this:
$.post( "/myajax.php",
{ "param1": value1, "param2": value2 },
function( data, status ) {
if( status == "success" ) {
$("#someid").html( data );
}
}, "html" );
While myajax.php is doing whatever it needs to ...
Does anyone know how to string a group of arrays into a single variable? I am trying to covert the a date format into another format, but i need to string to the arrays.
$datetochange="2008-11-5";
$date_parts=explode("-", $datetochange);
//Displays 2008
print $date_parts[0];
//Displays 11
print $date_parts[1];
//Displays 5
print $da...
I'm trying to highlight the search results but I want to include the surrounding text that is limited by the enclosing tags.
So if the $term is "cool" the preg_replace should end up with:
<div><span style="background: #f00">My hair cut so cool!</span></div>
Unfortunately my regex doesn't seem to capture the surrounding text, only the...
I have seen a lot of ob_get_clean() the last while. Typically I have done $test .= 'test'
I'm wondering if one is faster and/or better than the other.
Here is the code using ob_get_clean():
ob_start();
foreach($items as $item) {
echo '<div>' . $item . '</div>';
}
$test = ob_get_clean();
Here is the code using $test .= 'test':
...
Hi,
I want to take a string in PHP and discard everything after a certain character. However, it needs to search for not just one character, but an array of them. As soon as it gets to one of the characters in the array, it should return the string before that point.
For instance, if I have an array:
$chars = array("a", "b", "c");
H...