Questions tagged [spl]

SPL is a collection of PHP interfaces and classes that are meant to solve standard problems. This tag is not to be confused with the [shakespeare-lang] tag for Shakespeare Programming Language

SPL stands for Standard PHP Library. It is a collection of PHP interfaces and classes that are meant to solve standard problems. It contains a large set of predefined iterators, data-structures, interfaces and exceptions that can be used and extended.

Documentation can be found here. It is available by default from PHP 5.0.0 onwards.

365 questions
0
votes
1 answer

how to use spl_autoload_register

I am just learning how to use spl_autoload_register I have a folder structure that looks like this: lib/projectname/home/homepage.php so if I include the file like this it works: include("lib/projectname/home/homepage.php"); $home = new…
Lawrence Cooke
  • 1,567
  • 3
  • 26
  • 52
0
votes
3 answers

memory leak while processing large CSV

I have a script that downloads a large product CSV file, processes the information therein (downloading images and resizing and preparing other data for database insertion), then creates another txt file of all the processed items. The problem is…
chaoskreator
  • 889
  • 1
  • 17
  • 39
0
votes
1 answer

Get all parent nodes with RecursiveArrayIterator

Essentially, I want to use the $foo = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack)); Methodology, but instead of returning a flat array for foreach()ing through, keep the structure but only return a single great-grand-child…
Bojangles
  • 99,427
  • 50
  • 170
  • 208
0
votes
1 answer

Android: record decibel from microphone

i've got problem on implementing this functionality in Android... i need only to output the decibel redorded from the microphone, and it's a thing that i can't understand: public class Noise extends Activity{ @Override protected void onCreate(Bundle…
Zak
  • 591
  • 2
  • 15
  • 37
0
votes
4 answers

Array of Objects in PHP

I've created a class that keeps some information in its attributes. It contains add() method that adds a new set of information to all of the present in this class attributes. I'd like its objects to behave like array offsets. For example,…
khernik
  • 259
  • 3
  • 7
0
votes
3 answers

PHP: What is this object type, and how do I add to it without causing warnings

I've encountered this here and there, and I always worked around it, but I've just gotta know. Is this an array, an object, or ??? (Let's say I got this via var_export($co)) stdClass::__set_state(array( 'name' => 'Acme Anvil Corp.', )) Most…
mOrloff
  • 2,547
  • 4
  • 29
  • 48
0
votes
0 answers

Php, Spl, SimpleXMLIterator

I am trying to understand some guide part, I kind of really lost the logic at the following explanation: First The Code:Link Now the guide: A problem arises in XML when two documents may have similar names. If we had the xml document of animals,…
Aviel Fedida
  • 4,004
  • 9
  • 54
  • 88
0
votes
1 answer

How can I use one class inside another with the same namespace?

I'm using spl_autoload in my project, but when I try the following code, it gives me this error: Fatal error: Class 'Router\Route' not found in //Router File //Route…
Tomer Simis
  • 193
  • 2
  • 4
0
votes
2 answers

Render multi dimensional array using Iterator

I have the next multi dimensional array: Array ( [0] => Array ( [id] => 1 [name] => Category 1 [parent] => 0 [children] => Array ( [0] => Array …
Alex Pliutau
  • 21,392
  • 27
  • 113
  • 143
0
votes
2 answers

PHP Observer Pattern, Issue

Bellow is a PHP script. I tried to implement the Observer pattern (without MVC structure)... only basic. The error which is encountered has been specified in a comment. First I tried to add User objects to the UsersLibrary repository. There was a…
Zer
  • 13
  • 2
0
votes
2 answers

PHP, SPL, AccessArray Interface with Iterator Interface

I was thinking about AccessArray interface and the Iterator interface and i was thinking can we combine them?, I mean Setting up array with AccessArray and use a foreach loop with the Iterator, If can some one please help me with example if it…
Aviel Fedida
  • 4,004
  • 9
  • 54
  • 88
0
votes
2 answers

PHP - Initialize object members with array parameter

Is it possible to initialize an objects private or protected members in php with an associative array. for example: class TestClass { public $_name; public $_age; public function __construct(array $params) { ?????? …
Marty Wallace
  • 34,046
  • 53
  • 137
  • 200
-1
votes
1 answer

Call function through self (recursion) doesnt works via SPL auto loader

When I call any function without recursion (class is loaded by SPL) - all fine, but if that function is calling itself (recursion) - nothing works. If I use function without autoloader - all works great. I think that happens because object of class…
-1
votes
2 answers

RecursiveIteratorIterator Blank Page

I'm trying to use RecursiveIteratorIterator and RecursiveDirectoryIterator. I want get all file inside my c:\ folder. But i don't know why i can't get the result but a blank page. $it = new RecursiveIteratorIterator(new…
Ahmad
  • 4,224
  • 8
  • 29
  • 40
-1
votes
2 answers

SPL and U-Boot placement

Storage device for an embedded system is organized as: Non-partitioned space, saved for U-Boot. BOOT-VAR6UL - A FAT16 partition containing the Linux image and the device tree blob/s. "rootfs" - An ext4 partition containing the root file system…
LittleSaints
  • 391
  • 1
  • 6
  • 19
1 2 3
24
25