BetterPHP PHP Library

Written something you are proud of, post it here.
User avatar
Kamal
Posts: 123
Joined: Fri May 06, 2011 10:45 am
Contact:

Re: BetterPHP PHP Library

Post by Kamal »

jacek wrote:Yes they are mine :lol:

They are also the ones in the git if you bothered to look ! :shock:

I did see the ones in the git, but there are more in the zip i posted
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

Yeah, they are things I decided were less useful ;)
Image
Tino
Posts: 360
Joined: Thu May 05, 2011 8:55 pm
Location: The Netherlands

Re: BetterPHP PHP Library

Post by Tino »

Alright, so other things have come up, which definitely take priority over this. Sorry guys, you'll have to wait a tad longer :(
Please check out my CodeCanyon items.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

No rush ;)

Go do more interesting things.
Image
Dominion
Posts: 32
Joined: Thu May 05, 2011 11:32 pm

Re: BetterPHP PHP Library

Post by Dominion »

What kind of things are you looking for? My library has a fair few security check functions, but all the more useful functions I use tend to be site specific. Would I be able to add some JS functions?
btw - Js functions != using Jquery ;)
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

Anything that would be useful can be added :D

And I think JavaScript would have to be a different project, mostly because of the name.
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

well, mine will be continued upon arrival of a mySQL class ;)

No rush tino :D
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

bowersbros wrote:well, mine will be continued upon arrival of a mySQL class ;)

No rush tino :D


I added a basic one :) you should be able to use it to make your thing, and Tino can add some more complicated things to my mysql class if he feels like it :)
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

how would i use the mysql class within? Like.. for the mysql server connection?
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

it would be a global variable so...

[syntax=php]class user {

public function get_names(){
global $mysql;

$mysql->query('SELECT `name` FROM `users`');
$mysql->fetch_array($names);

return $names;
}

}[/syntax]

Go with that for now ;)
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

Hmm, say if i have two arrays, both setup as single dimensions how can i fuse them together?

So for example, I have these:


[syntax=php]$array1 = array('users','table1','table2','table3');
$array2 = array('username','password','blah','blah');[/syntax]

How could i make it so that the $array 1 values were the keys, and the $array2 values were the values?

(This is to be used for the validation thing, to check for unique values in a mysql field(s))

/edit.

Or should i do it where it is one multidimensional arrays so they can check multiple things within 1 array.

Eg.

array('users' => array('username','email))

Like that.

However, i dont know how to do either atm (spend 4 hours solid literature revision, my brain hurts!)

which method is best?
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

bowersbros wrote:How could i make it so that the $array 1 values were the keys, and the $array2 values were the values?

array_combine() will do that for you

bowersbros wrote:Or should i do it where it is one multidimensional arrays so they can check multiple things within 1 array.

Entirely up to you :) do it the best way :)
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

jacek wrote:
bowersbros wrote:How could i make it so that the $array 1 values were the keys, and the $array2 values were the values?

array_combine() will do that for you

bowersbros wrote:Or should i do it where it is one multidimensional arrays so they can check multiple things within 1 array.

Entirely up to you :) do it the best way :)


there is an is_array() function, is there something that checks for multidimensional array? if so, i could incorporate both ;)
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Re: BetterPHP PHP Library

Post by unemployment »

Where will these library files be accessible from? Surely, just posting them in this thread is terribly inefficient.
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

unemployment wrote:Where will these library files be accessible from? Surely, just posting them in this thread is terribly inefficient.


read first post
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

got it, apparently:

[syntax=php]if (count($array) == count($array, COUNT_RECURSIVE)) { echo 'array is not multidimensional'; } else { echo 'array is multidimensional'; }[/syntax] works
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

Oh I see what you wanted to do now, well you seem to have found a good enough solution ;)
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

jacek wrote:Oh I see what you wanted to do now, well you seem to have found a good enough solution ;)


is that the best way? or is there like a hidden function that is obscure yet does this? ;) if not. they should make one :D
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

bowersbros wrote:is that the best way? or is there like a hidden function that is obscure yet does this?

I don't know of a way to do that other than what you did.

bowersbros wrote:if not. they should make one :D

Or we should for the library :D
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: BetterPHP PHP Library

Post by bowersbros »

that would require a new functions.inc.php file then ;)

If you want to start it, uplaod it and just include:

[syntax=php]
function is_multi(array $array){
if(count($array) == count($array, COUNT_RECURSIVE)) return false;
}
[/syntax]
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: BetterPHP PHP Library

Post by jacek »

^^ done :)
Image
Post Reply