Hi all.
Is there any simple way of checking if all elements of an array are instances of a specific type without looping all elements? Or at least an easy way to get all elements of type X from an array.
Thank you.
Regards,
Diogo
...
Hello,
Say I've got some square images which I want to resize to rectangle images with the ratio 16:9. What is the best way to do it using PHP?
...
I'm using DOMPDF to generate about 500 reports from one script. It's running out of memory after about 10-15 PDFs have been generated.
In debugging, it looks like it's loading 8M every time it gets to the font loading stuff, but this seems like something that should be handled with the font caching code.
Any ideas of what's going wrong...
I'm not very good with preg_match so please forgive me if this is easy. So far I have...
preg_match("/".$clear_user."\/[0-9]{10}/", $old_data, $matches)
The thing I'm trying to match looks like..
:userid/time()
Right now, the preg_match would have a problem with 22/1266978013 and 2/1266978013. I need to figure out how to match the...
I need to add some errors to the Validation helper in Kohana 3.
Here is what I start with:
// validate form
$post = Validate::factory($_POST)
// Trim all fields
->filter(TRUE, 'trim')
// Rules for name
->rule('first-name', 'not_empty')
->rule('last-nam...
I am looking for a function that would be the alphabetic equivalent of is_numeric. It would return true if there are only letters in the string and false otherwise. Does a built in function exist in PHP?
...
Hi All,
Was wondering if anyone had any smart approaches to creating dynamic vanity user urls upon user registration. My site basically uses emails as usernames. I have the regex to strip the text before the "@" symbol (e.g. "[email protected]" becomes "name") I would then like to take the "name" and create a vanity url (e.g. domain.com/na...
We're having this discussion here. Which is better and why?
1) a php file that just includes a function...
function bar(){}
called like this
bar();
2) a php that contains a class with a static method.
class foo{
static function bar(){}
}
called like this
foo::bar();
Are there any performance reasons to do one or the other?...
Hi all,
I have the following String
First Last <[email protected]>
I would like to extract
"first.last"
from the email string using regex & PHP. How to go about this?
Thanks in advance!
...
i m just wondering if we can do this with preg replace
like if there's time like
1h 38 min
can change to
98 mins
2h 20 min
can change to
140 mins
or just suggest me any other random function to this is simpler way
thanks
...
hi all, i have a post with a LOT of variables, and I was wondering if there was some way of inserting the information into mysql dynamically, rather than typing it all out manually, as the post variables change depending on what the user selects.
...
So I have a class.. In its constructor I include the code which connects me to my database via the mysqli extension:
class MyClass
{
public function __construct()
{
include("dbconnect");
}
}
dbconnect looks like this:
$host = "localhost";
$user = "user";
$pass = "123";
$database = "myDatabase";
$mysqli = new mysq...
Hey guys, ive search around and nothing ius QUITE what i need, i am horrible with php thus far.
Basically, i have a text file serving as a database.
each line has the form:
id|lat|lng|details
where:
id is a unique integer, lat and lng are float and string details.
I have a client page (locked under user-pass) in which the user ente...
Does anyone how can I check whether the mailserver I use is down or not with php?
...
If I try to execute two MySQL queries at once by delimitting them with a semicolon, it works fine in PHP MyAdmin, but the query doesn't work at all in PHP mysql_query(). Does anyone know why?
...
Hello everyone,
I am using a AJAX gallery called jCarousel, and I am having some difficulties about dynamicly loading my pictures from the data, I simply don’t know how to integrate PHP in the JavaScript code.
The static JavaScript code for loading the pictures is:
var mycarousel_itemList = [
{url: \"http://static.flickr.com/66/199...
Hi there guys.
Here's my code for registerFormOne.php:
<html>
<head>
<title>Registration Form - 1 of 2</title>
</head>
<body>
<h1>Registration - Part 1 of 2</h1>
<p>Please fill in all the required information before submitting the information.</p>
<form action="registerFormTwo.php" method="post">
First Name:<in...
Does anyone know how can I catch mail error (error display while sening email and the error is caused by the mailserver down) in php?
Error that caused by emailserver down as below:
<!--2010-02-24T14:26:43+11:00 NOTICE (5): Unexpected Error: mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to mailserver at "ip "...
Hi Guys,
I am using Windows server 2003, IIS6, php and mysql. I have a problem setting the cronjob using built in schedule task feature in Windows OS.
Start > Programs > Accessories > System Tools > Schedule Tasks
Add "new schedule task"
It asks me choose programs. Should I choose php.exe or internet explorer, because php files run on...
I have two pages, A and B.
I want to echo a variable written in A inside of the page in B.
Here's the first page:
<?php session_start(); ?>
<html>
<head>
<title>Registration Form - 1 of 2</title>
</head>
<body>
<h1>Registration - Part 1 of 2</h1>
<p>Please fill in all the required information before submittin...