Tagged Questions
-2
votes
0answers
18 views
How to remove error undefined index from select and fetch query in php [on hold]
i am working on Bayesian code for classification. i have error of undefined index in learning and classify function in undefined index. i used the code from ...
1
vote
1answer
43 views
PHP spell checker with suggestions for misspelled words
I built a simple PHP spellchecker and suggestions app that uses PHP's similar_text() and levenshtein() functions to compare words from a dictionary that is loaded into an array.
How it works is ...
0
votes
0answers
37 views
Twitter API PHP script is EXTREMELY SLOW … What could be causing this ? the page takes a long time to display results
So I have this PHP script below that requests data from the Twitter API and then displays it on the page according to the information that I have in my local database because I stored twitter ...
0
votes
2answers
38 views
Performance testing in PHP
I need to test performance of a function in PHP. This has to happen accurately, of course. In the end I need to know how long it takes for a function to perform. What I'm doing now:
<?php
$start = ...
-2
votes
0answers
33 views
foreach loop array
protected static function arrayShuffling($itemsArray)
{
$itemSwitching = array();Switching
$shItem= array();
foreach ($itemArray as $i => $myItem) {
if ...
-1
votes
2answers
40 views
WebSite stucture with PHP [closed]
Can you help me to write my rewrite rules for this page.
When I write : contact.html?id=2
I want get : index.php?location=contact&id=2
That's my index page.
<?php
...
3
votes
2answers
88 views
Potential Problems with this templating technique
I like the way Zend Framework works it's views and I make extensive use of partials but every partial include results in it's own file system hit. As I'm building my own framework I thought I could do ...
3
votes
1answer
137 views
Improvement of my php code
I wrote a class with this function. Can I improve my code performance in the bottom of the function? I don't like the while loops!
public function loadFields(array $fields, $as_object = ...
2
votes
1answer
51 views
Can I do something better in that code? And improvements?
Hi guys, simple question!
Can I do something better with the code I wrote.
It's running problem less. It's just a snippet of a library I wrote.
Thank you for all answers!
<?php
/*
* ...
1
vote
1answer
59 views
array to return on conditions
I am writing a method to find me a price range for special price as well as the retail price. Such as in example below I have price range for retail from 129 to 329 where as special price range is 89 ...
0
votes
1answer
51 views
Should a User class only contain attributes and no methods apart from getters/setters?
I'm trying to improve my OOP code and I think my User class is becoming way too fat.
In my program a user has rights over "lists". Read, Write, Update, Delete.
So I made a User class
class User
{
...
2
votes
1answer
157 views
PHP - Alternated Caesar Cipher, code could be improved?
I've recently picked up PHP and due to having an IT-security class I tried out to code the first assignment in PHP.
The algorithm I took upon is an alternation of the caesar cipher, instead of using a ...
1
vote
1answer
45 views
Referring to nested arrays and array_merge (php)
In such an array:
$arr = Array (
[key0] => Array (
[subkey0] => Array (
[0] => "value0"
[1] => "value1"
)
[subkey1] => Array (
...
0
votes
2answers
83 views
Image Upload Script Security Review
<?php
$filename = $_FILE['inputfile']['name'];
$upload_path = 'images/';
//extract extension
$ext = strtolower(substr($filename, strrpos($filename, '.') + 1));
// return mime type ala mimetype ...
1
vote
1answer
53 views
How to optimize the pagination query?
This is completely optimization question, I have a pagination query like that
$this->paginate = array(
'fields' => array(
'DISTINCT Contact.contact_id',
...