Tech Note: PHP Functions Ported to Javascript

Hopelessly nerding out
Technology • Views: 46,613

If you’re a PHP coder who also codes Javascript, here’s an insanely useful site where they’ve converted most of the useful PHP functions into Javascript, keeping the syntax intact: PHP functions in JavaScript.

I’m currently using their versions of base64_decode(), utf8_decode(), addslashes(), and str_replace() in the LGF Javascript codebase, and they work beautifully.

Jump to bottom

57 comments
1 Holidays are Family Fun Time  Wed, Jul 20, 2011 6:26:45pm

What did he say?

2 Charles Johnson  Wed, Jul 20, 2011 6:31:12pm

It's all about a function at the junction.

3 Charles Johnson  Wed, Jul 20, 2011 6:32:44pm
4 albusteve  Wed, Jul 20, 2011 6:34:06pm

what about conjunction junction?
(cool song)

5 Holidays are Family Fun Time  Wed, Jul 20, 2011 6:35:31pm

School House Rock!

Yes, I remember . . .

6 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 6:40:09pm

re: #5 ggt

School House Rock is like the 60's. If you remember it, you weren't there.

7 albusteve  Wed, Jul 20, 2011 6:41:39pm

re: #3 Charles

[Video]

has that Motown feel....Phil Spector

8 Holidays are Family Fun Time  Wed, Jul 20, 2011 6:43:28pm

re: #6 Slumbering Behemoth

School House Rock is like the 60's. If you remember it, you weren't there.

H.R. Puff N' Stuff? The Archies?

Man, I was there!

9 Killgore Trout  Wed, Jul 20, 2011 6:44:07pm
RACISTS: Democrats Demand Allen West Apologize For Criticizing White Woman. I guess they figure he doesn’t know his place.

Hey, I didn’t make the racial rules for political discourse. I’m just following their previous application.

Posted at 9:11 pm by Glenn Reynolds


What a dick.

10 Holidays are Family Fun Time  Wed, Jul 20, 2011 6:44:53pm

re: #9 Killgore Trout

What a dick.

Which one?

11 SpaceJesus  Wed, Jul 20, 2011 6:47:05pm

sorry. so sorry.

12 Killgore Trout  Wed, Jul 20, 2011 6:48:00pm
13 Holidays are Family Fun Time  Wed, Jul 20, 2011 6:49:11pm

re: #12 Killgore Trout

Instapundit: 'Shoeshine Boy' Picture Not Racist

I think both Allen West and Glen Reynolds deserve the diss . . .

14 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 6:52:27pm

re: #11 SpaceJesus

sorry. so sorry.

[Video]

Of course you know, this means war!

15 Vicious Babushka  Wed, Jul 20, 2011 6:53:12pm

Wow, I got an actual fan mail! Somebody actually reads my website! I don't mean "Vicious Babushka," I mean the huge historical research site of which the Zionist Mall is just the gift shop.

16 SpaceJesus  Wed, Jul 20, 2011 6:55:40pm

re: #14 Slumbering Behemoth

oh my i dont even

17 albusteve  Wed, Jul 20, 2011 6:56:33pm

re: #15 Alouette

Wow, I got an actual fan mail! Somebody actually reads my website! I don't mean "Vicious Babushka," I mean the huge historical research site of which the Zionist Mall is just the gift shop.

it can be a hassle...I had to set up a Dept Of Fanmail to deal with it, but revenue from keychain sales pays for it

18 Holidays are Family Fun Time  Wed, Jul 20, 2011 6:58:09pm

I must say I'm torn, but I've decided to take the High Road.

19 SpaceJesus  Wed, Jul 20, 2011 6:58:51pm

re: #14 Slumbering Behemoth


en garde


20 Charles Johnson  Wed, Jul 20, 2011 7:07:48pm

‪Refrigerator Cat.

21 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:08:49pm

re: #19 SpaceJesus

en garde

[Video]

Dude. That was freaking epic.

22 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:11:02pm

re: #20 Charles

You know it's hot when...

23 Holidays are Family Fun Time  Wed, Jul 20, 2011 7:15:48pm

I'm off for a while.

Have a great evening all!

24 albusteve  Wed, Jul 20, 2011 7:19:47pm

some Slim Harpo
Shake Your Hips

25 albusteve  Wed, Jul 20, 2011 7:22:17pm

Stones cover Slim Harpo...
shows their reverence for the old guys

26 A Man for all Seasons  Wed, Jul 20, 2011 7:24:25pm

re: #24 albusteve

some Slim Harpo
Shake Your Hips

[Video]

most excellent

27 albusteve  Wed, Jul 20, 2011 7:31:37pm

re: #26 HoosierHoops

most excellent

yeah, the Stones covered his hit 'I'm A King Bee'

Stones version...
straight up blues

28 Four More Tears  Wed, Jul 20, 2011 7:31:49pm

Congress Continues Debate Over Whether Or Not Nation Should Be Economically Ruined

"It is a question that, I think, is worthy of serious consideration: Should we take steps to avoid a crippling, decades-long depression that would lead to disastrous consequences on a worldwide scale? Or should we not do that?" asked House Majority Leader Eric Cantor (R-VA), adding that arguments could be made for both sides, and that the debate over ensuring America’s financial solvency versus allowing the nation to default on its debt—which would torpedo stock markets, cause mortgage and interests rates to skyrocket, and decimate the value of the U.S. dollar—is “certainly a conversation worth having.”

I can't tell if the Onion's getting too real or if reality's getting too Oniony...

29 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:32:31pm

I see this is going to be on television tonight...

'Battle With the Devil': 'Nightline' Anchor Terry Moran Describes Meeting Those Who Believe Satan Tortured Them

In a small church just outside Buffalo, N.Y., people are retching and coughing up into paper bags. A few are incessantly, forcefully, weirdly yawning. An 8-year-old boy is tackled and pinned to the ground as he yells out, "Get off of me!" Someone gets hit in the back of the head by a large man erupting around the room in a screaming fit. There is much fervent praying and quiet weeping.

There is something else going on here, too. In the belief of these Christians at the Agape Bible Fellowship in East Aurora, New York, a "deliverance ministry," there is a triumph unfolding before our cameras -- a triumph over Satan.

Dear Gravel, I hate tv.

30 WINDUPBIRD DISEASE [S.K.U.M.M.]  Wed, Jul 20, 2011 7:33:51pm

re: #29 Slumbering Behemoth

Soundtrack by Venom

31 Kragar  Wed, Jul 20, 2011 7:34:45pm

re: #29 Slumbering Behemoth

I see this is going to be on television tonight...

'Battle With the Devil': 'Nightline' Anchor Terry Moran Describes Meeting Those Who Believe Satan Tortured Them

Dear Gravel, I hate tv.

Might I suggest some books?

32 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:36:52pm

re: #31 Kragar (Proud to be Kafir)

Might I suggest some books?

I'm too busy reading LGF to invest any time in books.

But seriously, do you have any actual suggestions? I'm open.

33 Kragar  Wed, Jul 20, 2011 7:38:30pm

re: #32 Slumbering Behemoth

I'm too busy reading LGF to invest any time in books.

But seriously, do you have any actual suggestions? I'm open.

Fact or fiction?

34 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:39:14pm

re: #32 Slumbering Behemoth

And if you link any W40K fan fiction erotica, I'm coming to your place and peeing into your computer.

35 Kragar  Wed, Jul 20, 2011 7:40:46pm

re: #34 Slumbering Behemoth

And if you link any W40K fan fiction erotica, I'm coming to your place and peeing into your computer.

I wasn't going to, but now that you mention it...

jk

36 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:40:57pm

re: #33 Kragar (Proud to be Kafir)

Fact or fiction?

I like all kinds of stuff. Whatever ya got. Keeping the previous comment of mine in mind, of course.

37 laZardo  Wed, Jul 20, 2011 7:45:09pm

re: #34 Slumbering Behemoth

And if you link any W40K fan fiction erotica, I'm coming to your place and peeing into your computer.

COME AT ME BRO

38 OhCrapIHaveACrushOnSarahPalin  Wed, Jul 20, 2011 7:45:44pm

re: #9 Killgore Trout

What a dick.

What is with these stupid rwnj and "I'm rubber you're glue"?

Have any of them graduated fifth grade?

39 WINDUPBIRD DISEASE [S.K.U.M.M.]  Wed, Jul 20, 2011 7:45:47pm

re: #32 Slumbering Behemoth

I'm too busy reading LGF to invest any time in books.

But seriously, do you have any actual suggestions? I'm open.

Iain Banks! [Link: www.amazon.com...]

40 Kragar  Wed, Jul 20, 2011 7:46:24pm

re: #36 Slumbering Behemoth

I like all kinds of stuff. Whatever ya got. Keeping the previous comment of mine in mind, of course.

Island of the Lost: Shipwrecked at the Edge of the World

True story. 2 different crew shipwreck on opposite sides of a rugged island over the same few months. One crew works together and manages to all make it thru alive after months on the island. The other crew falls apart and go from 50 something men to barely a handful in just a few weeks.

41 William Barnett-Lewis  Wed, Jul 20, 2011 7:48:59pm

re: #36 Slumbering Behemoth

I like all kinds of stuff. Whatever ya got. Keeping the previous comment of mine in mind, of course.

I'm rereading the Harry Potter books because my son has taken to them. They're holding up quite well a few years later.

42 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:49:38pm

re: #39 WindUpBird

re: #40 Kragar (Proud to be Kafir)

Book marked, and thanks guys. Both sound like interesting reads.

re: #37 laZardo

And you? I'm coming to your place and peeing into your computer. Strike that, I'm gonna get a few cats to pee into your computer.

43 Kragar  Wed, Jul 20, 2011 7:50:54pm

re: #41 wlewisiii

I'm rereading the Harry Potter books because my son has taken to them. They're holding up quite well a few years later.

Rereading the Horus Heresy series from the start right now. Once thats done, I'll restart the Wheel of Time so I'll have the entire series reread by the time the last book comes out.

44 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:52:23pm

re: #41 wlewisiii

I'm rereading the Harry Potter books because my son has taken to them. They're holding up quite well a few years later.

There was a comedian ranting about adults reading Harry Potter on the subway on the way to work.

"You're not supposed to be reading your kid's books on the subway, you're supposed to be sitting here quietly, wondering what the fuck happened to your life"!

45 Kragar  Wed, Jul 20, 2011 7:54:57pm

And the shameless plugging of my hobby

Horus Rising: Anniversary Edition (The Horus Heresy)

Under the benevolent leadership of the Immortal Emperor the Imperium of Man has stretched out across the galaxy. On the eve of victory, the Emperor leaves the front lines, entrusting the great crusade to his favorite son, Horus. Promoted to Warmaster, the idealistic Horus tries to carry out the Emperor'sgrand design, all the while the seeds of heresy and rebellion have been sowed amongst his brothers.

46 William Barnett-Lewis  Wed, Jul 20, 2011 7:56:01pm

re: #44 Slumbering Behemoth

There was a comedian ranting about adults reading Harry Potter on the subway on the way to work.

"You're not supposed to be reading your kid's books on the subway, you're supposed to be sitting here quietly, wondering what the fuck happened to your life"!

Heh. I enjoy reading to him - Treasure Island, Harry Potter, Narnia ... lots of real literature out there for kids. I'm thinking about giving him a go with The Hobbit this fall :D Once he's hooked it's on to LotR!

47 Slumbering Behemoth Stinks  Wed, Jul 20, 2011 7:56:47pm

Come to think of it, I still have the last three books in the Dark Tower series on my shelf that I haven't read yet. It's been well over a decade since I read the fourth one, so I may just start over. Hmm...

48 OhCrapIHaveACrushOnSarahPalin  Wed, Jul 20, 2011 7:58:53pm

Your High-Drama 80s Keyboards Clip of the Day:

49 Kragar  Wed, Jul 20, 2011 8:00:11pm

re: #46 wlewisiii

Heh. I enjoy reading to him - Treasure Island, Harry Potter, Narnia ... lots of real literature out there for kids. I'm thinking about giving him a go with The Hobbit this fall :D Once he's hooked it's on to LotR!

Get the transition book to ease him from Potter to LotR

Harry Potter and Bao Zoulong

fans eagerly pored over their new books and journeyed through the enchanting tale of Harry Potter and Bao Zoulong, where Harry turns into a hobbit, discovers a magic ring and ... battles a dragon.

Sound familiar?

That's because, in what may have been the most ridiculous act of plagiarism ever, Bashu Publishing House printed thousands of books claiming to be the Rowling's next masterpiece that were not in fact Rowling's. An anonymous "author" took a word-for-word translation of The Hobbit and changed the names to those of Harry Potter and his friends (with the exception of Gandalf, who is apparently so unlike Dumbledore that any comparison would just be silly). He also added a chapter at the beginning, explaining how Harry was turned into a hobbit while taking a bath one day, and a few paragraphs at the end describing how he became human again.

50 William Barnett-Lewis  Wed, Jul 20, 2011 8:03:09pm

re: #49 Kragar (Proud to be Kafir)

That sounds amazingly insane. I may have to find a copy just to see which set of fans can scream in pain the loudest :LOL:

51 kirkspencer  Wed, Jul 20, 2011 8:17:25pm

re: #45 Kragar (Proud to be Kafir)

And the shameless plugging of my hobby

Horus Rising: Anniversary Edition (The Horus Heresy)

Isn't it about time for the next edition?

52 Kragar  Wed, Jul 20, 2011 8:33:12pm

re: #51 kirkspencer

Isn't it about time for the next edition?

Not for a while yet I think.

53 CuriousLurker  Wed, Jul 20, 2011 9:33:42pm
If you’re a PHP coder who also codes Javascript, here’s an insanely useful site where they’ve converted most of the useful PHP functions into Javascript, keeping the syntax intact: PHP functions in JavaScript.

I’m currently using their versions of base64_decode(), utf8_decode(), addslashes(), and str_replace() in the LGF Javascript codebase, and they work beautiful

Sahhweeet—thanks!

54 Fozzie Bear  Wed, Jul 20, 2011 9:40:36pm

PHP? Eeeeeewwww.

55 shutdown  Wed, Jul 20, 2011 11:39:21pm

re: #53 CuriousLurker

Sahhweeet—thanks!

You are a PHP Coder?

56 CuriousLurker  Wed, Jul 20, 2011 11:48:19pm

re: #55 imp_62

You are a PHP Coder?

Among other duties, yep.

57 otoc  Thu, Jul 21, 2011 10:10:59am

Thanks for that link. Will check it out.


This article has been archived.
Comments are closed.

Jump to top

Create a PageThis is the LGF Pages posting bookmarklet. To use it, drag this button to your browser's bookmark bar, and title it 'LGF Pages' (or whatever you like). Then browse to a site you want to post, select some text on the page to use for a quote, click the bookmarklet, and the Pages posting window will appear with the title, text, and any embedded video or audio files already filled in, ready to go.
Or... you can just click this button to open the Pages posting window right away.
Last updated: 2023-04-04 11:11 am PDT
LGF User's Guide RSS Feeds

Help support Little Green Footballs!

Subscribe now for ad-free access!Register and sign in to a free LGF account before subscribing, and your ad-free access will be automatically enabled.

Donate with
PayPal
Cash.app
Recent PagesClick to refresh