Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

andreekeberg/serialized-search-replace

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serialized Search and Replace

Latest Stable Version Total Downloads License

Easily replace strings found in content containing data serialized by the serialize function without corrupting your data, by correcting all length values included in these objects before returning the replaced content.

Requirements

  • PHP 4.0.0 or higher

Installation

composer require andreekeberg/serialized-search-replace

Usage

Basic usage

$output = SerializedSearchReplace::replace(
    'http://example.com',
    'https://example.com',
    serialize([
        'url' => 'http://example.com/'
    ])
);

Returns:

a:1:{s:3:"url";s:20:"https://example.com/";}

Getting the number of replacements performed

Passing $count by reference to get the total number of replacements performed:

$output = SerializedSearchReplace::replace(
    'http://example.com',
    'https://example.com',
    serialize([
        'url' => 'http://example.com/'
    ]),
    $count
);

Value of $count:

1

Documentation

Contributing

Read the contribution guidelines.

Changelog

Refer to the changelog for a full history of the project.

License

Serialized Search and Replace is licensed under the MIT license.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.