Results 1 to 5 of 5
  1. #1
    ooen Guest

    Default Creating a static array in php

    I have a question. How do you create a static array in php?

  2. #2
    Join Date
    Aug 2004
    Location
    Oradea, Romania
    Posts
    135

    Default

    Quote Originally Posted by ooen
    I have a question. How do you create a static array in php?
    Using array() function ? Using sessions? It really depends on what you understand by static array in PHP...

    --
    Alex
    Web Hosting & Domain Names UK
    Webmaster Forums
    Internet Access Web Hosting

  3. #3
    ooen Guest

    Default

    This is what I want to do. There is a list of directories that I want to store in an array, but I want to run the routine only once to create the array, and I want to make a static reference so that I can just keep referencing it. How can I do this?

  4. #4
    Join Date
    Aug 2004
    Location
    Oradea, Romania
    Posts
    135

    Default

    Quote Originally Posted by ooen
    This is what I want to do. There is a list of directories that I want to store in an array, but I want to run the routine only once to create the array, and I want to make a static reference so that I can just keep referencing it. How can I do this?
    If you want to run a routine only once to create an array all you have to do is
    Code:
    if (!isset($my_nice_array)){
      // routine to populate the array here...
      ...
    }
    but looking at that article I intend to believe that what you are actually trying to achieve is making "search engine friendly" URLs. If that is the case, these two articles might explain a bit better the subject:
    http://www.sitepoint.com/article/sea...friendly-urls/
    http://www.devshed.com/c/a/Apache/Se...h-mod-rewrite/

    --
    Alex
    Web Hosting & Domain Names UK
    Webmaster Forums
    Internet Access Web Hosting

  5. #5
    ooen Guest

    Default

    I actually read both articles while back :) . The problem is that this is not good enough if you want to create descriptive URL strings; this is how I came up with a solution I presented in the paper. However, I didn't know how I can create the array only once in php. Now I know ... Thanks :) .

Similar Threads

  1. Parham's PHP Tutorial
    By Ardenn in forum Website Programming Discussion
    Replies: 15
    Last Post: 07-19-2012, 10:56 AM
  2. Simple PHP Template Tutorial
    By theomnis in forum Website Programming Discussion
    Replies: 9
    Last Post: 03-27-2012, 07:54 AM
  3. PHP & PHPBB security
    By ealex in forum Computers
    Replies: 0
    Last Post: 11-09-2005, 12:49 PM
  4. PHP Security: PHPSC Site launched!
    By alexandru in forum Computers
    Replies: 0
    Last Post: 02-07-2005, 01:28 PM
  5. PHP Security <- A MUST READ
    By alexandru in forum Website Programming Discussion
    Replies: 0
    Last Post: 01-19-2005, 01:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159