PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 15, 2022

[FIXED] How to Remove \r and \n from json string in cakephp 3?

 March 15, 2022     cakephp, cakephp-3.0, json     No comments   

Issue

I have String like below after doing json_encode

[{"pid":1,"name":"Patient1","mobile":"123456789","birthdate":"07/23/1991","address":"57, New Building,\r\nCollege Road,\r\nPune-3545001","created":"2017-09-25T08:14:10+00:00","modified":"2017-09-25T12:27:20+00:00"}]

so how can i remove \r and \n.


Solution

str_replace('\r\n', '', $string);


Answered By - Alex Stallen
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing